Search in sources :

Example 26 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner 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)

Example 27 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project linuxtools by eclipse.

the class SpecfileDocumentProvider method getDocument.

@Override
public IDocument getDocument(Object element) {
    IDocument document = super.getDocument(element);
    if (document != null && document.getDocumentPartitioner() == null) {
        FastPartitioner partitioner = new FastPartitioner(new SpecfilePartitionScanner(), SpecfilePartitionScanner.SPEC_PARTITION_TYPES);
        partitioner.connect(document, false);
        document.setDocumentPartitioner(partitioner);
    }
    return document;
}
Also used : FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) SpecfilePartitionScanner(org.eclipse.linuxtools.internal.rpm.ui.editor.scanners.SpecfilePartitionScanner) IDocument(org.eclipse.jface.text.IDocument)

Example 28 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project linuxtools by eclipse.

the class SuppressionsDocumentProvider method getDocument.

@Override
public IDocument getDocument(Object element) {
    IDocument document = super.getDocument(element);
    if (document != null) {
        FastPartitioner partitioner = new FastPartitioner(new RuleBasedPartitionScanner(), SuppressionsPartitionScanner.SUPP_CONTENT_TYPES);
        partitioner.connect(document, false);
        if (document.getDocumentPartitioner() == null) {
            document.setDocumentPartitioner(partitioner);
        }
    }
    return document;
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocument(org.eclipse.jface.text.IDocument)

Example 29 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project tmdm-studio-se by Talend.

the class XMLDocumentProvider method createDocument.

// XMLEditor editor;
// public XMLDocumentProvider(XMLEditor editor){
// this.editor=editor;
// }
protected IDocument createDocument(Object element) throws CoreException {
    if (element instanceof XMLEditorInput) {
        // IDocument document = super.createDocument(element);
        IDocument document = ((XMLEditorInput) element).getDocument();
        if (document != null) {
            IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
            partitioner.connect(document);
            document.setDocumentPartitioner(partitioner);
        }
        return document;
    }
    return null;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocument(org.eclipse.jface.text.IDocument)

Example 30 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project tmdm-studio-se by Talend.

the class ElementFKInfoFormatViewer method intallDocument.

private void intallDocument(IDocument doc) {
    IDocumentPartitioner partitioner = new FastPartitioner(new ElementFKInfotPartitionScanner(), new String[] { ElementFKInfotPartitionScanner.COMMON_STRING });
    partitioner.connect(doc);
    doc.setDocumentPartitioner(partitioner);
    setDocument(doc, annotationModel);
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner)

Aggregations

FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)37 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)25 IDocument (org.eclipse.jface.text.IDocument)17 IDocumentExtension3 (org.eclipse.jface.text.IDocumentExtension3)14 RuleBasedPartitionScanner (org.eclipse.jface.text.rules.RuleBasedPartitionScanner)5 Document (org.eclipse.jface.text.Document)4 DocumentEvent (org.eclipse.jface.text.DocumentEvent)4 IDocumentListener (org.eclipse.jface.text.IDocumentListener)4 IPredicateRule (org.eclipse.jface.text.rules.IPredicateRule)4 Token (org.eclipse.jface.text.rules.Token)4 IPartitionTokenScanner (org.eclipse.jface.text.rules.IPartitionTokenScanner)3 SQLDocument (com.cubrid.common.ui.query.editor.SQLDocument)2 SQLPartitionScanner (com.cubrid.common.ui.query.editor.SQLPartitionScanner)2 SQLTextViewer (com.cubrid.common.ui.query.editor.SQLTextViewer)2 SQLViewerConfiguration (com.cubrid.common.ui.query.editor.SQLViewerConfiguration)2 DocumentProvider (com.cubrid.tool.editor.DocumentProvider)2 ArrayList (java.util.ArrayList)2 TextViewerUndoManager (org.eclipse.jface.text.TextViewerUndoManager)2 IToken (org.eclipse.jface.text.rules.IToken)2 MultiLineRule (org.eclipse.jface.text.rules.MultiLineRule)2