use of org.eclipse.jface.text.IDocumentPartitioner in project titan.EclipsePlug-ins by eclipse.
the class DocumentSetupParticipant method setup.
@Override
public void setup(final IDocument document) {
DocumentTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), document);
IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(PartitionScanner.TTCNPP_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
document.addDocumentListener(new IDocumentListener() {
@Override
public void documentAboutToBeChanged(final DocumentEvent event) {
GlobalIntervalHandler.putInterval(event.getDocument(), null);
}
@Override
public void documentChanged(final DocumentEvent event) {
// Do nothing
}
});
}
use of org.eclipse.jface.text.IDocumentPartitioner in project ch.hsr.ifs.cdttesting by IFS-HSR.
the class DocumentProvider method createDocument.
@Override
protected IDocument createDocument(final Object element) throws CoreException {
final IDocument document = super.createDocument(element);
if (document != null) {
final IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), TestFile.PARTITION_TYPES);
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return document;
}
use of org.eclipse.jface.text.IDocumentPartitioner in project soot by Sable.
the class JimpleDocumentProvider method createDocument.
/* (non-Javadoc)
* Method declared on AbstractDocumentProvider
*/
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
if (document != null) {
IDocumentPartitioner partitioner = new DefaultPartitioner(new JimplePartitionScanner(), new String[] { JimplePartitionScanner.JIMPLE_STRING });
partitioner.connect(document);
document.setDocumentPartitioner(partitioner);
}
return document;
}
use of org.eclipse.jface.text.IDocumentPartitioner in project webtools.sourceediting by eclipse.
the class TestStructuredPartitionerHTML method testGetPartitionType.
public void testGetPartitionType() {
IStructuredModel model = null;
try {
model = getModelForEdit("testfiles/html/example01.xml");
if (model != null) {
IStructuredDocument sDoc = model.getStructuredDocument();
assertTrue("sDoc implementation not instance of IDocumentExtension3", sDoc instanceof IDocumentExtension3);
IDocumentPartitioner partitioner = ((IDocumentExtension3) sDoc).getDocumentPartitioner(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
assertTrue("paritioner doesn't implement IStructuredTextPartitioner", partitioner instanceof IStructuredTextPartitioner);
IStructuredTextPartitioner stp = (IStructuredTextPartitioner) partitioner;
String defaultPartitionType = stp.getDefaultPartitionType();
assertTrue("wrong default partition type was: [" + defaultPartitionType + "] should be: [" + IXMLPartitions.XML_DEFAULT + "]", defaultPartitionType.equals(IXMLPartitions.XML_DEFAULT));
} else {
assertTrue("could not retrieve structured model", false);
}
} finally {
if (model != null)
model.releaseFromEdit();
}
}
use of org.eclipse.jface.text.IDocumentPartitioner in project webtools.sourceediting by eclipse.
the class TestStructuredPartitionerHTML method testDisconnectConnect.
public void testDisconnectConnect() {
IStructuredModel model = null;
try {
model = getModelForEdit("testfiles/html/example01.xml");
if (model != null) {
IStructuredDocument sDoc = model.getStructuredDocument();
assertTrue("sDoc implementation not instance of IDocumentExtension3", sDoc instanceof IDocumentExtension3);
IDocumentPartitioner partitioner = ((IDocumentExtension3) sDoc).getDocumentPartitioner(IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING);
assertTrue("partitioner doesn't implement IStructuredTextPartitioner", partitioner instanceof IStructuredTextPartitioner);
IStructuredTextPartitioner stp = (IStructuredTextPartitioner) partitioner;
assertNotNull("partitioner was null for sDoc:" + sDoc, partitioner);
try {
stp.disconnect();
} catch (Exception e) {
assertTrue("problem disconnecting w/:" + sDoc + "/n" + e, false);
}
try {
stp.connect(sDoc);
} catch (Exception e) {
assertTrue("problem connecting w/:" + sDoc + "/n" + e, false);
}
} else {
assertTrue("could not retrieve structured model", false);
}
} finally {
if (model != null)
model.releaseFromEdit();
}
}
Aggregations