Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/tabs
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv21776/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/tabs
Modified Files:
FormattedSourceTab.java
Log Message:
Introduced new API method that allows plugins to install a custom formatter class. This can be particularly useful for stored procedures which would be very hard to write a good generic pretty-printer.
Index: FormattedSourceTab.java
===================================================================
RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/objecttree/tabs/FormattedSourceTab.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FormattedSourceTab.java 25 Dec 2009 03:00:47 -0000 1.9
--- FormattedSourceTab.java 28 Dec 2009 23:39:21 -0000 1.10
***************
*** 29,32 ****
--- 29,33 ----
import net.sourceforge.squirrel_sql.fw.codereformat.CodeReformator;
import net.sourceforge.squirrel_sql.fw.codereformat.CommentSpec;
+ import net.sourceforge.squirrel_sql.fw.codereformat.ICodeReformator;
import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo;
import net.sourceforge.squirrel_sql.fw.sql.ISQLConnection;
***************
*** 55,59 ****
/** does the work of formatting */
! private CodeReformator formatter = null;
/** whether or not to compress whitespace */
--- 56,60 ----
/** does the work of formatting */
! private ICodeReformator formatter = null;
/** whether or not to compress whitespace */
***************
*** 103,106 ****
--- 104,130 ----
/**
+ * Sets up a custom formatter implementation which is used to format the source after retrieving it from
+ * the ResultSet. If this is not setup prior to loading, then the formatter will not be used - only
+ * whitespace compressed if so enabled.
+ *
+ * @param codeReformator
+ * @param stmtSep
+ * the formatter needs to know what the statement separator is.
+ * @param commentSpecs
+ * the types of comments that can be found in the source code. This can be null, and if so, the
+ * standard comment styles are used (i.e. -- and c-style comments)
+ */
+ protected void setupFormatter(ICodeReformator codeReformator, String stmtSep, CommentSpec[] commentSpecs)
+ {
+ if (commentSpecs != null)
+ {
+ this.commentSpecs = commentSpecs;
+ }
+ statementSeparator = stmtSep;
+ formatter = codeReformator;
+ }
+
+
+ /**
* Whether or not to convert multiple consecutive spaces into a single space.
*
***************
*** 181,184 ****
--- 205,209 ----
}
_ta.setCaretPosition(0);
+ _ta.setTabSize(4);
}
|