1 11 package org.eclipse.ant.internal.ui.editor.text; 12 13 import org.eclipse.core.filebuffers.IDocumentSetupParticipant; 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.jface.text.IDocumentExtension3; 16 import org.eclipse.jface.text.IDocumentPartitioner; 17 import org.eclipse.jface.text.rules.FastPartitioner; 18 19 22 public class AntDocumentSetupParticipant implements IDocumentSetupParticipant { 23 24 28 public final static String ANT_PARTITIONING= "org.eclipse.ant.ui.antPartitioning"; 30 public AntDocumentSetupParticipant() { 31 } 32 33 36 public void setup(IDocument document) { 37 if (document instanceof IDocumentExtension3) { 38 IDocumentExtension3 extension3= (IDocumentExtension3) document; 39 IDocumentPartitioner partitioner = createDocumentPartitioner(); 40 extension3.setDocumentPartitioner(ANT_PARTITIONING, partitioner); 41 partitioner.connect(document); 42 } 43 } 44 45 private IDocumentPartitioner createDocumentPartitioner() { 46 return new FastPartitioner( 47 new AntEditorPartitionScanner(), new String []{ 48 AntEditorPartitionScanner.XML_TAG, 49 AntEditorPartitionScanner.XML_COMMENT, 50 AntEditorPartitionScanner.XML_CDATA, 51 AntEditorPartitionScanner.XML_DTD}); 52 } 53 } 54 | Popular Tags |