Java Code Examples for org.eclipse.jface.text.IDocumentExtension3#setDocumentPartitioner()
The following examples show how to use
org.eclipse.jface.text.IDocumentExtension3#setDocumentPartitioner() .
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: DocumentProvider.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
@Override protected IDocument createDocument(Object element) throws CoreException { IDocument document = super.createDocument(element); //IDocumentPartitioner partitioner = createDocumentPartitioner(); IDocumentPartitioner partitioner = new ImpexDocumentPartitioner(); if ((document instanceof IDocumentExtension3)) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; extension3.setDocumentPartitioner(Activator.IMPEX_PARTITIONING, partitioner); } else { document.setDocumentPartitioner(partitioner); } partitioner.connect(document); return document; }
Example 2
Source File: PartitionUtils.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
/** * Sets document's partitioner. * * @param document the document to be processed * @param partitioningType the partitioning for which to set the partitioner * @param partitioner the document's new partitioner * * @see org.eclipse.jface.text.IDocumentExtension3#setDocumentPartitioner(IDocument,String,IDocumentPartitioner) * @see IDocumentPartitioningListener */ public static void setDocumentPartitioning( IDocument document , String partitioningType , IDocumentPartitioner partitioner ) { // Setting the partitioner will trigger a partitionChanged listener that // will attempt to use the partitioner to initialize the document's // partitions. Therefore, need to connect first. partitioner.connect(document); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; extension3.setDocumentPartitioner(partitioningType, partitioner); } else { document.setDocumentPartitioner(partitioner); } }
Example 3
Source File: PyPartitionScanner.java From Pydev with Eclipse Public License 1.0 | 6 votes |
/** * @see http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_documents.htm * @see http://jroller.com/page/bobfoster - Saturday July 16, 2005 * @param document the document where we want to add the partitioner * @return the added document partitioner (or null) */ public static IDocumentPartitioner addPartitionScanner(IDocument document, IGrammarVersionProvider grammarVersionProvider) { if (document != null) { IDocumentExtension3 docExtension = (IDocumentExtension3) document; IDocumentPartitioner curr = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE); if (curr == null) { //set the new one PyPartitioner partitioner = createPyPartitioner(); partitioner.connect(document); docExtension.setDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE, partitioner); return partitioner; } else { return curr; } } return null; }
Example 4
Source File: BibSetupParticipant.java From texlipse with Eclipse Public License 1.0 | 5 votes |
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: TexDocumentSetupParticipant.java From texlipse with Eclipse Public License 1.0 | 5 votes |
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 6
Source File: TLADocumentSetupParticipant.java From tlaplus with MIT License | 5 votes |
public void setup(IDocument document) { if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; IDocumentPartitioner partitioner= new TLAFastPartitioner(TLAEditorActivator.getDefault().getTLAPartitionScanner(), TLAPartitionScanner.TLA_PARTITION_TYPES); // Changed from FastPartitioner by LL on 12 Aug 2012 extension3.setDocumentPartitioner(TLAPartitionScanner.TLA_PARTITIONING, partitioner); partitioner.connect(document); } }
Example 7
Source File: JavaTextTools.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Sets up the Java document partitioner for the given document for the given partitioning. * * @param document the document to be set up * @param partitioning the document partitioning * @since 3.0 */ public void setupJavaDocumentPartitioner(IDocument document, String partitioning) { IDocumentPartitioner partitioner= createDocumentPartitioner(); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; extension3.setDocumentPartitioner(partitioning, partitioner); } else { document.setDocumentPartitioner(partitioner); } partitioner.connect(document); }
Example 8
Source File: PropertiesFileDocumentSetupParticipant.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * @param document the document * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) */ public static void setupDocument(IDocument document) { IDocumentPartitioner partitioner= createDocumentPartitioner(); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3= (IDocumentExtension3) document; extension3.setDocumentPartitioner(IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING, partitioner); } else { document.setDocumentPartitioner(partitioner); } partitioner.connect(document); }
Example 9
Source File: EditorConfigDocumentSetupParticipant.java From editorconfig-eclipse with Apache License 2.0 | 5 votes |
public static void setupDocument(IDocument document) { IDocumentPartitioner partitioner = createDocumentPartitioner(); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; extension3.setDocumentPartitioner(IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING, partitioner); } else { document.setDocumentPartitioner(partitioner); } partitioner.connect(document); }
Example 10
Source File: LangDocumentPartitionerSetup.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public void setupPartitioningIfNotSet(IDocument document) { if(document instanceof IDocumentExtension3) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; String partitioning = TextSettings_Actual.PARTITIONING_ID; if(extension3.getDocumentPartitioner(partitioning) == null) { IDocumentPartitioner partitioner = createDocumentPartitioner(); partitioner.connect(document); extension3.setDocumentPartitioner(partitioning, partitioner); } } }
Example 11
Source File: EclipseUtils.java From goclipse with Eclipse Public License 1.0 | 5 votes |
public static void setupDocumentPartitioner(IDocument document, String partitioning, IDocumentPartitioner partitioner) { assertNotNull(document); assertNotNull(partitioning); assertNotNull(partitioner); partitioner.connect(document); if (document instanceof IDocumentExtension3) { IDocumentExtension3 extension3 = (IDocumentExtension3) document; extension3.setDocumentPartitioner(partitioning, partitioner); } else { document.setDocumentPartitioner(partitioner); } }