Search in sources :

Example 11 with IPartitionTokenScanner

use of org.eclipse.jface.text.rules.IPartitionTokenScanner in project hale by halestudio.

the class GroovySourceViewerUtil method setupDocument.

/**
 * Setup a Groovy document.
 *
 * @param doc the document
 */
public static void setupDocument(IDocument doc) {
    IPartitionTokenScanner scanner = new GroovyPartitionScanner();
    IDocumentPartitioner partitioner = new FastPartitioner(scanner, GroovyPartitionScanner.LEGAL_CONTENT_TYPES);
    doc.setDocumentPartitioner(partitioner);
    partitioner.connect(doc);
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IPartitionTokenScanner(org.eclipse.jface.text.rules.IPartitionTokenScanner) GroovyPartitionScanner(eu.esdihumboldt.hale.ui.util.groovy.internal.GroovyPartitionScanner)

Aggregations

IPartitionTokenScanner (org.eclipse.jface.text.rules.IPartitionTokenScanner)11 IPredicateRule (org.eclipse.jface.text.rules.IPredicateRule)10 IToken (org.eclipse.jface.text.rules.IToken)10 RuleBasedPartitionScanner (org.eclipse.jface.text.rules.RuleBasedPartitionScanner)10 Token (org.eclipse.jface.text.rules.Token)10 MultiLineRule (org.eclipse.jface.text.rules.MultiLineRule)8 Test (org.junit.Test)5 Document (org.eclipse.jface.text.Document)4 IDocument (org.eclipse.jface.text.IDocument)4 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)3 SingleLineRule (org.eclipse.jface.text.rules.SingleLineRule)2 Before (org.junit.Before)2 GroovyPartitionScanner (eu.esdihumboldt.hale.ui.util.groovy.internal.GroovyPartitionScanner)1 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)1