1 package com.quantum.editors;
3 import org.eclipse.core.runtime.CoreException;
4 import org.eclipse.jface.text.IDocument;
5 import org.eclipse.jface.text.IDocumentPartitioner;
6 import org.eclipse.jface.text.rules.DefaultPartitioner;
7 import org.eclipse.ui.editors.text.FileDocumentProvider;
9 public class SQLDocumentProvider extends FileDocumentProvider {
11 public SQLDocumentProvider() {
15 protected IDocument createDocument(Object element) throws CoreException {
16 //System.out.println("element: " + element.getClass().getName());
17 IDocument document = super.createDocument(element);
18 if (document != null) {
19 IDocumentPartitioner partitioner =
20 new DefaultPartitioner(
21 new SQLPartitionScanner(),
23 IDocument.DEFAULT_CONTENT_TYPE,
24 SQLPartitionScanner.SQL_KEYWORD,
25 SQLPartitionScanner.SQL_COMMENT,
26 SQLPartitionScanner.SQL_IDENTIFIER,
27 SQLPartitionScanner.SQL_STRING,
28 SQLPartitionScanner.SQL_SEPARATOR,
29 SQLPartitionScanner.SQL_SYMBOL,
30 SQLPartitionScanner.SQL_NUMERIC });
31 partitioner.connect(document);
32 document.setDocumentPartitioner(partitioner);