Search in sources :

Example 1 with STPPartitionScanner

use of org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPPartitionScanner in project linuxtools by eclipse.

the class STPFormattingTest method setupDocumentPartitioner.

/**
 * Sets up the document partitioner for the given document for the given partitioning.
 *
 * @param document
 * @param partitioning
 * @param owner may be null
 */
private static void setupDocumentPartitioner(IDocument document, String partitioning) {
    IDocumentPartitioner partitioner = new FastPartitioner(new STPPartitionScanner(), STPPartitionScanner.STP_PARTITION_TYPES);
    if (document instanceof IDocumentExtension3) {
        IDocumentExtension3 extension3 = (IDocumentExtension3) document;
        extension3.setDocumentPartitioner(partitioning, partitioner);
    } else {
        document.setDocumentPartitioner(partitioner);
    }
    partitioner.connect(document);
}
Also used : IDocumentExtension3(org.eclipse.jface.text.IDocumentExtension3) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) STPPartitionScanner(org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPPartitionScanner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner)

Aggregations

IDocumentExtension3 (org.eclipse.jface.text.IDocumentExtension3)1 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)1 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)1 STPPartitionScanner (org.eclipse.linuxtools.internal.systemtap.ui.ide.editors.stp.STPPartitionScanner)1