org.eclipse.datatools.sqltools.common.ui.sqlstatementarea
Interface ISQLSourceViewerService

All Known Implementing Classes:
SQLSourceViewerService

public interface ISQLSourceViewerService

This interface defines some help methods which are needed by SQLStatementArea. The consumer of SQLStatementArea must create an instance implementing this interface and pass it in when creating instance of SQLStatementArea.

Author:
Shi-feng Yu

Method Summary
 void setUpDocument(org.eclipse.jface.text.IDocument doc, java.lang.String dbType)
          This method is used for user to customize the document setting.
 

Method Detail

setUpDocument

void setUpDocument(org.eclipse.jface.text.IDocument doc,
                   java.lang.String dbType)
This method is used for user to customize the document setting.

The document used by SQLStatementArea needs a PartitionSanner and Partitioner to compute the partitions. Through this method, user can set up customized PartitionSanner with customized rules.

Sample code for setting up a document

 XXXPartitionScanner _xxxPartitionSanner = new XXXPartitionScanner();
   _xxxPartitionSanner.setCommentsScanner(SQLToolsFacade.getSQLSyntax(dbType));
   if (document instanceof IDocumentExtension3)
   {
       IDocumentExtension3 extension3 = (IDocumentExtension3) document;
       FastPartitioner _partitioner = new FastPartitioner(_sqlPartitionSanner, new String[]
       {
           XXXPartitionScanner.SQL_CODE, XXXPartitionScanner.SQL_COMMENT,
           XXXPartitionScanner.SQL_MULTILINE_COMMENT, XXXPartitionScanner.SQL_STRING,
           XXXPartitionScanner.SQL_DOUBLE_QUOTES_IDENTIFIER
       });
       _partitioner.connect(document);
       extension3.setDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING, _partitioner);
   }
 

Parameters:
doc - the Document to be set up
dbType - the Database type of the SQL Statement which is contained in the Document.