KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > freemarker > eclipse > editors > DocumentProvider


1 package freemarker.eclipse.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
10 /**
11  * @version $Id: DocumentProvider.java,v 1.4 2003/11/30 22:22:04 cederberg Exp $
12  * @author <a HREF="mailto:stephan@chaquotay.net">Stephan Mueller</a>
13  */

14 public class DocumentProvider extends FileDocumentProvider {
15
16     public DocumentProvider() {
17         super();
18     }
19
20     protected IDocument createDocument(Object JavaDoc element) throws CoreException {
21         IDocument document = super.createDocument(element);
22         if (document != null) {
23             IDocumentPartitioner partitioner =
24                 new DefaultPartitioner(
25                     new PartitionScanner(),
26                     PartitionScanner.PARTITIONS);
27             partitioner.connect(document);
28             document.setDocumentPartitioner(partitioner);
29         }
30         return document;
31     }
32 }
33
Popular Tags