Search in sources :

Example 11 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project syncope by apache.

the class HTMLFileDocumentProvider method createDocument.

public IDocument createDocument(final Object element) throws CoreException {
    IDocument document = super.createDocument(element);
    if (document != null) {
        IDocumentPartitioner partitioner = new FastPartitioner(new HTMLPartitionScanner(), new String[] { HTMLPartitionScanner.HTML_TAG, HTMLPartitionScanner.HTML_COMMENT, HTMLPartitionScanner.HTML_SCRIPT, HTMLPartitionScanner.HTML_DOCTYPE, HTMLPartitionScanner.HTML_DIRECTIVE, HTMLPartitionScanner.JAVASCRIPT, HTMLPartitionScanner.HTML_CSS, HTMLPartitionScanner.SYNCOPE_TAG });
        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 12 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project usbdm-eclipse-plugins by podonoghue.

the class DocumentProvider method getDocument.

@Override
public IDocument getDocument(Object element) {
    IDocument document = super.getDocument(element);
    if (document != null) {
        IDocumentPartitioner partitioner = new Partitioner(new PartitionScanner(), new String[] { PartitionScanner.C_IGNORED_COMMENT, PartitionScanner.C_COMMENT, PartitionScanner.C_IDENTIFIER, PartitionScanner.C_STRING, PartitionScanner.C_NUMBER });
        partitioner.connect(document);
        document.setDocumentPartitioner(partitioner);
    }
    return document;
}
Also used : IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) IDocument(org.eclipse.jface.text.IDocument) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner)

Example 13 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project titan.EclipsePlug-ins by eclipse.

the class DocumentSetupParticipant method setup.

@Override
public void setup(final IDocument document) {
    IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES);
    if (document instanceof IDocumentExtension3) {
        IDocumentExtension3 extension3 = (IDocumentExtension3) document;
        extension3.setDocumentPartitioner(PartitionScanner.CONFIG_PARTITIONING, partitioner);
    } else {
        document.setDocumentPartitioner(partitioner);
    }
    partitioner.connect(document);
    document.addDocumentListener(new IDocumentListener() {

        @Override
        public void documentAboutToBeChanged(final DocumentEvent event) {
            GlobalIntervalHandler.putInterval(event.getDocument(), null);
        }

        @Override
        public void documentChanged(final DocumentEvent event) {
        // Do nothing
        }
    });
}
Also used : IDocumentExtension3(org.eclipse.jface.text.IDocumentExtension3) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocumentListener(org.eclipse.jface.text.IDocumentListener) DocumentEvent(org.eclipse.jface.text.DocumentEvent)

Example 14 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project titan.EclipsePlug-ins by eclipse.

the class DocumentSetupParticipant method setup.

/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.
	 * eclipse.jface.text.IDocument)
	 */
@Override
public void setup(final IDocument document) {
    EditorTracker.remove(editor);
    EditorTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), editor);
    DocumentTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), document);
    IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES);
    if (document instanceof IDocumentExtension3) {
        IDocumentExtension3 extension3 = (IDocumentExtension3) document;
        extension3.setDocumentPartitioner(PartitionScanner.ASN1_PARTITIONING, partitioner);
    } else {
        document.setDocumentPartitioner(partitioner);
    }
    partitioner.connect(document);
    document.addDocumentListener(new IDocumentListener() {

        @Override
        public void documentAboutToBeChanged(final DocumentEvent event) {
            GlobalIntervalHandler.putInterval(event.getDocument(), null);
        }

        @Override
        public void documentChanged(final DocumentEvent event) {
            IPreferencesService prefs = Platform.getPreferencesService();
            if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) {
                analyze(document, false);
            }
        }
    });
    analyze(document, true);
}
Also used : IDocumentExtension3(org.eclipse.jface.text.IDocumentExtension3) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocumentListener(org.eclipse.jface.text.IDocumentListener) DocumentEvent(org.eclipse.jface.text.DocumentEvent) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 15 with IDocumentPartitioner

use of org.eclipse.jface.text.IDocumentPartitioner in project titan.EclipsePlug-ins by eclipse.

the class DocumentSetupParticipant method setup.

/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.
	 * eclipse.jface.text.IDocument)
	 */
@Override
public void setup(final IDocument document) {
    DocumentTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), document);
    IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES);
    if (document instanceof IDocumentExtension3) {
        IDocumentExtension3 extension3 = (IDocumentExtension3) document;
        extension3.setDocumentPartitioner(PartitionScanner.TTCN3_PARTITIONING, partitioner);
    } else {
        document.setDocumentPartitioner(partitioner);
    }
    partitioner.connect(document);
    document.addDocumentListener(new IDocumentListener() {

        @Override
        public void documentAboutToBeChanged(final DocumentEvent event) {
            GlobalIntervalHandler.putInterval(event.getDocument(), null);
        }

        @Override
        public void documentChanged(final DocumentEvent event) {
        // Do nothing
        }
    });
}
Also used : IDocumentExtension3(org.eclipse.jface.text.IDocumentExtension3) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) FastPartitioner(org.eclipse.jface.text.rules.FastPartitioner) IDocumentListener(org.eclipse.jface.text.IDocumentListener) DocumentEvent(org.eclipse.jface.text.DocumentEvent)

Aggregations

IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)72 IDocument (org.eclipse.jface.text.IDocument)27 IDocumentExtension3 (org.eclipse.jface.text.IDocumentExtension3)27 FastPartitioner (org.eclipse.jface.text.rules.FastPartitioner)25 IStructuredDocument (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument)12 IStructuredModel (org.eclipse.wst.sse.core.internal.provisional.IStructuredModel)9 IFile (org.eclipse.core.resources.IFile)7 IModelManager (org.eclipse.wst.sse.core.internal.provisional.IModelManager)7 IStructuredTextPartitioner (org.eclipse.wst.sse.core.internal.provisional.text.IStructuredTextPartitioner)6 BadLocationException (org.eclipse.jface.text.BadLocationException)5 ITypedRegion (org.eclipse.jface.text.ITypedRegion)5 DocumentEvent (org.eclipse.jface.text.DocumentEvent)4 IDocumentListener (org.eclipse.jface.text.IDocumentListener)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 ITextFileBuffer (org.eclipse.core.filebuffers.ITextFileBuffer)3 IPath (org.eclipse.core.runtime.IPath)3 XtextDocument (org.eclipse.xtext.ui.editor.model.XtextDocument)3 SQLDocument (com.cubrid.common.ui.query.editor.SQLDocument)2 SQLPartitionScanner (com.cubrid.common.ui.query.editor.SQLPartitionScanner)2