use of org.eclipse.jface.text.rules.FastPartitioner in project titan.EclipsePlug-ins by eclipse.
the class DocumentSetupParticipant method setup.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.
* eclipse.jface.text.IDocument)
*/
@Override
public void setup(final IDocument document) {
EditorTracker.remove(editor);
EditorTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), editor);
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.ASN1_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) {
IPreferencesService prefs = Platform.getPreferencesService();
if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) {
analyze(document, false);
}
}
});
analyze(document, true);
}
use of org.eclipse.jface.text.rules.FastPartitioner in project titan.EclipsePlug-ins by eclipse.
the class DocumentSetupParticipant method setup.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.
* eclipse.jface.text.IDocument)
*/
@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.TTCN3_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.rules.FastPartitioner 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.rules.FastPartitioner 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.rules.FastPartitioner in project webtools.sourceediting by eclipse.
the class DefaultPartitionerZeroLengthTest method setUp.
public void setUp() {
fDoc = new Document();
IPartitionTokenScanner scanner = new RuleBasedPartitionScanner() {
{
IToken comment = new Token(COMMENT);
IPredicateRule[] rules = new IPredicateRule[] { new MultiLineRule("/*", "*/", comment) };
setPredicateRules(rules);
}
};
fPartitioner = new FastPartitioner(scanner, new String[] { DEFAULT, COMMENT });
fDoc.setDocumentPartitioner(fPartitioner);
fPartitioner.connect(fDoc);
}
Aggregations