2 * $RCSfile: JSDocumentProvider.java,v $
5 * CH-1700 Fribourg, Switzerland
8 *========================================================================
9 * Modifications history
10 *========================================================================
11 * $Log: not supported by cvs2svn $
12 * Revision 1.2 2004/02/26 02:25:57 agfitzp
13 * renamed packages to match xml & css
15 * Revision 1.1 2004/02/05 03:13:28 agfitzp
16 * Initial submission, outline view is broken due to refactoring
18 * Revision 1.1.2.1 2003/12/12 21:37:24 agfitzp
19 * Experimental work for Classes view
21 * Revision 1.1 2003/05/28 15:17:11 agfitzp
22 * net.sourceforge.phpeclipse.js.ui 0.0.1 code base
24 *========================================================================
27 package net.sourceforge.phpeclipse.js.ui.editors;
29 import net.sourceforge.phpeclipse.js.core.parser.JSPartitionScanner;
31 import org.eclipse.core.runtime.CoreException;
32 import org.eclipse.jface.text.IDocument;
33 import org.eclipse.jface.text.IDocumentPartitioner;
34 import org.eclipse.jface.text.rules.DefaultPartitioner;
35 import org.eclipse.ui.editors.text.FileDocumentProvider;
40 * @author $Author: jsurfer $, $Date: 2004-09-02 18:23:49 $
42 * @version $Revision: 1.1 $
44 public class JSDocumentProvider extends FileDocumentProvider {
47 * Array of constant token types that will be color hilighted.
49 private static String[] colorTokens= {
50 JSPartitionScanner.JS_COMMENT,
51 JSPartitionScanner.JS_STRING,
52 JSPartitionScanner.JS_KEYWORD
56 * Constructor for JSDocumentProvider.
58 public JSDocumentProvider() {
67 * @throws CoreException
69 protected IDocument createDocument(Object element) throws CoreException {
70 IDocument document = super.createDocument(element);
72 if (document != null) {
73 IDocumentPartitioner partitioner =
74 new DefaultPartitioner(new JSPartitionScanner(), colorTokens);
75 partitioner.connect(document);
76 document.setDocumentPartitioner(partitioner);