Search in sources :

Example 21 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project cubrid-manager by CUBRID.

the class PropDocumentProvider method getDocument.

/**
	 * Retrieves the document to be edited.
	 * 
	 * @param element Object
	 * @return IDocument
	 */
public IDocument getDocument(Object element) {
    IDocument document = null;
    if (element instanceof IEditorInput) {
        IEditorInput ei = ((IEditorInput) element);
        DocumentProvider dp = (DocumentProvider) ei.getAdapter(DocumentProvider.class);
        if (dp != null) {
            document = dp.getDocument(element);
        }
    }
    if (document == null) {
        document = new Document();
    }
    IDocumentPartitioner partitioner = new FastPartitioner(new PropPartitionScanner(), PropPartitionScanner.LEGAL_CONTENT_TYPES);
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
    return document;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) DocumentProvider(com.cubrid.tool.editor.DocumentProvider) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) IDocument(org.eclipse.jface.text.IDocument) IEditorInput(org.eclipse.ui.IEditorInput)

Example 22 with FastPartitioner

use of org.eclipse.jface.text.rules.FastPartitioner in project cubrid-manager by CUBRID.

the class XMLDocumentProvider method getDocument.

/**
	 * Retrieves the document to be edited.
	 * 
	 * @param element Object
	 * @return IDocument
	 */
public IDocument getDocument(Object element) {
    IDocument document = null;
    if (element instanceof IEditorInput) {
        IEditorInput ei = ((IEditorInput) element);
        DocumentProvider dp = (DocumentProvider) ei.getAdapter(DocumentProvider.class);
        if (dp != null) {
            document = dp.getDocument(element);
        }
    }
    if (document == null) {
        document = new Document();
    }
    IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT });
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);
    return document;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) DocumentProvider(com.cubrid.tool.editor.DocumentProvider) Document(org.eclipse.jface.text.Document) IDocument(org.eclipse.jface.text.IDocument) XMLPartitionScanner(com.cubrid.tool.editor.xml.scanner.XMLPartitionScanner) IDocument(org.eclipse.jface.text.IDocument) IEditorInput(org.eclipse.ui.IEditorInput)

Example 23 with FastPartitioner

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

the class XMLDocumentProvider method createDocument.

@Override
protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    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;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocument(org.eclipse.jface.text.IDocument)

Example 24 with FastPartitioner

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

the class AbstractPairMatcherTest method createPartitioner.

private static IDocumentPartitioner createPartitioner() {
    final RuleBasedPartitionScanner scan = new RuleBasedPartitionScanner();
    final List<SingleLineRule> rules = new ArrayList<>();
    rules.add(new SingleLineRule("|a", "a|", new Token("a")));
    rules.add(new SingleLineRule("|b", "b|", new Token("b")));
    rules.add(new SingleLineRule("|c", "c|", new Token("c")));
    scan.setPredicateRules(rules.toArray(new IPredicateRule[rules.size()]));
    scan.setDefaultReturnToken(new Token(DEFAULT_PARTITION));
    return new FastPartitioner(scan, new String[] { DEFAULT_PARTITION, "a", "b", "c" });
}
Also used : RuleBasedPartitionScanner(org.eclipse.jface.text.rules.RuleBasedPartitionScanner) SingleLineRule(org.eclipse.jface.text.rules.SingleLineRule) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) ArrayList(java.util.ArrayList) Token(org.eclipse.jface.text.rules.Token) IPredicateRule(org.eclipse.jface.text.rules.IPredicateRule)

Example 25 with FastPartitioner

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

the class DockerDocumentProvider method createDocument.

@Override
protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
        DockerPartitionScanner scanner = new DockerPartitionScanner();
        IDocumentPartitioner partitioner = new FastPartitioner(scanner, DockerPartitionScanner.ALLOWED_CONTENT_TYPES);
        partitioner.connect(document);
        document.setDocumentPartitioner(partitioner);
    }
    return document;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) DockerPartitionScanner(org.eclipse.linuxtools.internal.docker.editor.scanner.DockerPartitionScanner) IDocument(org.eclipse.jface.text.IDocument)

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