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 IDocument document = super.createDocument(element);
17 if (document != null) {
18 IDocumentPartitioner partitioner =
19 new DefaultPartitioner(
20 new SQLPartitionScanner(),
22 IDocument.DEFAULT_CONTENT_TYPE,
23 SQLPartitionScanner.SQL_KEYWORD,
24 SQLPartitionScanner.SQL_COMMENT,
25 SQLPartitionScanner.SQL_IDENTIFIER,
26 SQLPartitionScanner.SQL_STRING,
27 SQLPartitionScanner.SQL_SEPARATOR,
28 SQLPartitionScanner.SQL_SYMBOL,
29 SQLPartitionScanner.SQL_NUMERIC });
30 partitioner.connect(document);
31 document.setDocumentPartitioner(partitioner);