added file extension php5
[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                 IDocument document = super.createDocument(element);
17                 if (document != null) {
18                         IDocumentPartitioner partitioner =
19                                 new DefaultPartitioner(
20                                         new SQLPartitionScanner(),
21                                         new String[] { 
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);
32                 }
33                 return document;
34         }
35 }