1 11 package org.eclipse.pde.internal.ui.editor.context; 12 13 import org.eclipse.core.filebuffers.IDocumentSetupParticipant; 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.jface.text.IDocumentPartitioner; 16 import org.eclipse.jface.text.rules.FastPartitioner; 17 import org.eclipse.pde.internal.ui.editor.text.XMLPartitionScanner; 18 19 public class XMLDocumentSetupParticpant implements IDocumentSetupParticipant { 20 21 public void setup(IDocument document) { 22 IDocumentPartitioner partitioner = createDocumentPartitioner(); 23 if (partitioner != null) { 24 partitioner.connect(document); 25 document.setDocumentPartitioner(partitioner); 26 } 27 } 28 29 private IDocumentPartitioner createDocumentPartitioner() { 30 return new FastPartitioner(new XMLPartitionScanner(), XMLPartitionScanner.PARTITIONS); 31 } 32 33 } 34 | Popular Tags |