Search in sources :

Example 1 with IDocumentPartitionerExtension3

use of org.eclipse.jface.text.IDocumentPartitionerExtension3 in project webtools.sourceediting by eclipse.

the class BasicStructuredDocument method startRewriteSessionOnPartitioners.

/**
 * Starts the given rewrite session.
 *
 * @param session the rewrite session
 * @since 2.0
 */
final void startRewriteSessionOnPartitioners(DocumentRewriteSession session) {
    if (fDocumentPartitioners != null) {
        Iterator e = fDocumentPartitioners.values().iterator();
        while (e.hasNext()) {
            Object partitioner = e.next();
            if (partitioner instanceof IDocumentPartitionerExtension3) {
                IDocumentPartitionerExtension3 extension = (IDocumentPartitionerExtension3) partitioner;
                extension.startRewriteSession(session);
            }
        }
    }
}
Also used : IDocumentPartitionerExtension3(org.eclipse.jface.text.IDocumentPartitionerExtension3) Iterator(java.util.Iterator)

Example 2 with IDocumentPartitionerExtension3

use of org.eclipse.jface.text.IDocumentPartitionerExtension3 in project webtools.sourceediting by eclipse.

the class BasicStructuredDocument method stopRewriteSessionOnPartitioners.

/**
 * Stops the given rewrite session.
 *
 * @param session the rewrite session
 * @since 2.0
 */
final void stopRewriteSessionOnPartitioners(DocumentRewriteSession session) {
    if (fDocumentPartitioners != null) {
        DocumentPartitioningChangedEvent event = new DocumentPartitioningChangedEvent(this);
        Iterator e = fDocumentPartitioners.keySet().iterator();
        while (e.hasNext()) {
            String partitioning = (String) e.next();
            IDocumentPartitioner partitioner = (IDocumentPartitioner) fDocumentPartitioners.get(partitioning);
            if (partitioner instanceof IDocumentPartitionerExtension3) {
                IDocumentPartitionerExtension3 extension = (IDocumentPartitionerExtension3) partitioner;
                extension.stopRewriteSession(session);
                event.setPartitionChange(partitioning, 0, getLength());
            }
        }
        if (!event.isEmpty())
            fireDocumentPartitioningChanged(event);
    }
}
Also used : DocumentPartitioningChangedEvent(org.eclipse.jface.text.DocumentPartitioningChangedEvent) IDocumentPartitionerExtension3(org.eclipse.jface.text.IDocumentPartitionerExtension3) IDocumentPartitioner(org.eclipse.jface.text.IDocumentPartitioner) Iterator(java.util.Iterator)

Aggregations

Iterator (java.util.Iterator)2 IDocumentPartitionerExtension3 (org.eclipse.jface.text.IDocumentPartitionerExtension3)2 DocumentPartitioningChangedEvent (org.eclipse.jface.text.DocumentPartitioningChangedEvent)1 IDocumentPartitioner (org.eclipse.jface.text.IDocumentPartitioner)1