org.eclipse.jface.text.rules.FastPartitioner Java Examples

The following examples show how to use org.eclipse.jface.text.rules.FastPartitioner. 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 vote down vote up
/**
 * 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: SourceEditor.java    From textuml with Eclipse Public License 1.0 6 votes vote down vote up
public SourceEditor() {
    setSourceViewerConfiguration(new TextUMLSourceViewerConfiguration(this));
    // set the document provider to create the partitioner
    setDocumentProvider(new FileDocumentProvider() {
        protected IDocument createDocument(Object element) throws CoreException {
            IDocument document = super.createDocument(element);
            if (document != null) {
                // this will create partitions
                IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(),
                        ContentTypes.CONFIGURED_CONTENT_TYPES);
                partitioner.connect(document);
                document.setDocumentPartitioner(partitioner);
            }
            return document;
        }
    });
}
 
Example #3
Source File: TexDocumentSetupParticipant.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
public void setup(IDocument document) {
	if (document instanceof IDocumentExtension3) {
		IDocumentExtension3 extension3= (IDocumentExtension3) document;

		IDocumentPartitioner partitioner = 
		    new FastPartitioner(
		            new FastLaTeXPartitionScanner(), 
		            FastLaTeXPartitionScanner.TEX_PARTITION_TYPES);

		extension3.setDocumentPartitioner(TexEditor.TEX_PARTITIONING, partitioner);
        
		partitioner.connect(document);
		
	}	
}
 
Example #4
Source File: BibSetupParticipant.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
public void setup(IDocument document) {
    if (document instanceof IDocumentExtension3) {
        IDocumentExtension3 extension3 = (IDocumentExtension3) document;
        IDocumentPartitioner partitioner = 
            new FastPartitioner(new BibPartitionScanner(), BibPartitionScanner.BIB_PARTITION_TYPES);
        extension3.setDocumentPartitioner(BibEditor.BIB_PARTITIONING, partitioner);
        partitioner.connect(document);
    }
}
 
Example #5
Source File: JsonDocumentProvider.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 5 votes vote down vote up
@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 #6
Source File: JavaFormatter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 #7
Source File: JavaAutoIndentStrategy.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 #8
Source File: IDEFileReportDocumentProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #9
Source File: ReportDocumentProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #10
Source File: XMLDocumentProvider.java    From codeexamples-eclipse with Eclipse Public License 1.0 5 votes vote down vote up
@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;
}
 
Example #11
Source File: LangDocumentPartitionerSetup.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
protected FastPartitioner setupDocumentPartitioner(IDocument document, String partitioning) {
	FastPartitioner partitioner = createDocumentPartitioner();
	EclipseUtils.setupDocumentPartitioner(document, partitioning, partitioner);
	return partitioner;
}
 
Example #12
Source File: LangDocumentPartitionerSetup.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public FastPartitioner createDocumentPartitioner() {
	IPartitionTokenScanner scanner = LangUIPlugin_Actual.createPartitionScanner();
	return new FastPartitioner(scanner, LEGAL_CONTENT_TYPES);
}
 
Example #13
Source File: LangDocumentPartitionerSetup.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public FastPartitioner setupDocument(IDocument document) {
	return setupDocumentPartitioner(document, TextSettings_Actual.PARTITIONING_ID);
}
 
Example #14
Source File: Scanner_BaseTest.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public static FastPartitioner setupPartitioner(Document document, IPartitionTokenScanner partitionScanner,
		String partitioning, String[] legalContentTypes) {
	FastPartitioner fp = new FastPartitioner(partitionScanner, legalContentTypes);
	EclipseUtils.setupDocumentPartitioner(document, partitioning, fp);
	return fp;
}
 
Example #15
Source File: PropertiesStructureCreator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IDocumentPartitioner getDocumentPartitioner() {
	return new FastPartitioner(new PropertiesFilePartitionScanner(), IPropertiesFilePartitions.PARTITIONS);
}
 
Example #16
Source File: PropertiesFileMergeViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected IDocumentPartitioner getDocumentPartitioner() {
	return new FastPartitioner(new PropertiesFilePartitionScanner(), IPropertiesFilePartitions.PARTITIONS);
}
 
Example #17
Source File: TypeScriptTextTools.java    From typescript.java with MIT License 4 votes vote down vote up
@Override
public IDocumentPartitioner createDocumentPartitioner() {
	return new FastPartitioner(getPartitionScanner(), LEGAL_CONTENT_TYPES);
}
 
Example #18
Source File: TagBasedTLCOutputIncrementalParser.java    From tlaplus with MIT License 4 votes vote down vote up
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);
      }
  }
 
Example #19
Source File: EditorConfigDocumentSetupParticipant.java    From editorconfig-eclipse with Apache License 2.0 2 votes vote down vote up
/**
 * Factory method for creating a .editorconfig document specific document
 * partitioner.
 *
 * @return a newly created .editorconfig document partitioner
 */
private static IDocumentPartitioner createDocumentPartitioner() {
	return new FastPartitioner(new EditorConfigPartitionScanner(), IEditorConfigPartitions.PARTITIONS);
}
 
Example #20
Source File: PropertiesFileDocumentSetupParticipant.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Factory method for creating a properties file document specific document
 * partitioner.
 *
 * @return a newly created properties file document partitioner
 */
private static IDocumentPartitioner createDocumentPartitioner() {
	return new FastPartitioner(new PropertiesFilePartitionScanner(), IPropertiesFilePartitions.PARTITIONS);
}
 
Example #21
Source File: JavaTextTools.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Factory method for creating a Java-specific document partitioner
 * using this object's partitions scanner. This method is a
 * convenience method.
 *
 * @return a newly created Java document partitioner
 */
public IDocumentPartitioner createDocumentPartitioner() {
	return new FastPartitioner(getPartitionScanner(), LEGAL_CONTENT_TYPES);
}