remove name clash with JDT editor category
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / editors / SQLDocumentProvider.java
1 package com.quantum.editors;
2
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;
8
9 public class SQLDocumentProvider extends FileDocumentProvider {
10         
11         public SQLDocumentProvider() {
12                 super();
13         }
14
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(),
22                                         new String[] { 
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);
33                 }
34                 return document;
35         }
36 }