Java Code Examples for org.eclipse.jface.text.rules.FastPartitioner#connect()
The following examples show how to use
org.eclipse.jface.text.rules.FastPartitioner#connect() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeScriptAutoIndentStrategy.java From typescript.java with MIT License | 6 votes |
/** * Installs a java partitioner with <code>document</code>. * * @param document the document */ private static void installJavaStuff(Document document) { String[] types= new String[] { IJavaScriptPartitions.JAVA_DOC, IJavaScriptPartitions.JAVA_MULTI_LINE_COMMENT, IJavaScriptPartitions.JAVA_SINGLE_LINE_COMMENT, IJavaScriptPartitions.JAVA_STRING, IJavaScriptPartitions.JAVASCRIPT_TEMPLATE_LITERAL, IJavaScriptPartitions.JAVA_CHARACTER, IJSXPartitions.JSX, IDocument.DEFAULT_CONTENT_TYPE }; FastPartitioner partitioner= new FastPartitioner(new FastTypeScriptPartitionScanner(), types); partitioner.connect(document); document.setDocumentPartitioner(IJavaScriptPartitions.JAVA_PARTITIONING, partitioner); }
Example 2
Source File: JsonDocumentProvider.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); if (document != null) { JsonScanner scanner = new JsonScanner(new ColorManager(), store); Set<String> tokens = YAMLToken.VALID_TOKENS.keySet(); FastPartitioner partitioner = new FastPartitioner(scanner, tokens.toArray(new String[tokens.size()])); document.setDocumentPartitioner(partitioner); partitioner.connect(document); } return document; }
Example 3
Source File: JavaFormatter.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Installs a java partitioner with <code>document</code>. * * @param document the document */ private static void installJavaStuff(Document document) { String[] types= new String[] { IJavaPartitions.JAVA_DOC, IJavaPartitions.JAVA_MULTI_LINE_COMMENT, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT, IJavaPartitions.JAVA_STRING, IJavaPartitions.JAVA_CHARACTER, IDocument.DEFAULT_CONTENT_TYPE }; FastPartitioner partitioner= new FastPartitioner(new FastJavaPartitionScanner(), types); partitioner.connect(document); document.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner); }
Example 4
Source File: JavaAutoIndentStrategy.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Installs a java partitioner with <code>document</code>. * * @param document the document */ private static void installJavaStuff(Document document) { String[] types= new String[] { IJavaPartitions.JAVA_DOC, IJavaPartitions.JAVA_MULTI_LINE_COMMENT, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT, IJavaPartitions.JAVA_STRING, IJavaPartitions.JAVA_CHARACTER, IDocument.DEFAULT_CONTENT_TYPE }; FastPartitioner partitioner= new FastPartitioner(new FastJavaPartitionScanner(), types); partitioner.connect(document); document.setDocumentPartitioner(IJavaPartitions.JAVA_PARTITIONING, partitioner); }
Example 5
Source File: TagBasedTLCOutputIncrementalParser.java From tlaplus with MIT License | 4 votes |
public TagBasedTLCOutputIncrementalParser(Model model, int prio, boolean isTraceExplorer, Mode mode, final long size) { // create the document document = new LargeTextStoreDocument(size); this.analyzer = new TagBasedTLCAnalyzer(document); this.source = new CachingTLCOutputSource(model, prio); // set up the partitioner FastPartitioner partitioner = new FastPartitioner(new TagBasedTLCOutputTokenScanner(), TagBasedTLCOutputTokenScanner.CONTENT_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); // now register the listener, responsible for evaluating the partitioning information document.addDocumentPartitioningListener(new TLCOutputPartitionChangeListener(mode)); /* * Register the process source * * There are two different source registries, one for trace exploration * and one for model checking. The source must be added to the * appropriate registry. */ if (isTraceExplorer) { TLCOutputSourceRegistry.getTraceExploreSourceRegistry().addTLCOutputSource(this.source); } else { if (mode == Mode.BATCH) { // TLC always appends to the document. Therefore, we can tell the // document to use a more efficient rewrite mode which reduces the time // taken to execute replace operations from minutes and hours to // seconds. // Its down side is that the ResultPage is only updated when the // complete log file is fully parsed, whereas in incremental // mode, it (potentially) updates after each line. document.startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL); } TLCOutputSourceRegistry.getModelCheckSourceRegistry().addTLCOutputSource(this.source); } }