01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.editors.xml;
05:
06: import org.eclipse.core.runtime.CoreException;
07: import org.eclipse.jface.text.IDocument;
08: import org.eclipse.jface.text.IDocumentPartitioner;
09: import org.eclipse.jface.text.rules.FastPartitioner;
10: import org.eclipse.ui.editors.text.FileDocumentProvider;
11:
12: public class XMLDocumentProvider extends FileDocumentProvider {
13:
14: protected IDocument createDocument(Object element)
15: throws CoreException {
16: IDocument document = super .createDocument(element);
17: if (document != null) {
18: IDocumentPartitioner partitioner = new FastPartitioner(
19: new XMLPartitionScanner(), new String[] {
20: XMLPartitionScanner.XML_TAG,
21: XMLPartitionScanner.XML_COMMENT });
22: partitioner.connect(document);
23: document.setDocumentPartitioner(partitioner);
24: }
25: return document;
26: }
27: }
|