Search in sources :

Example 1 with DocumentPartitioningChangedEvent

use of org.eclipse.jface.text.DocumentPartitioningChangedEvent 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)

Example 2 with DocumentPartitioningChangedEvent

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

the class BasicStructuredDocument method setDocumentPartitioner.

public void setDocumentPartitioner(String partitioning, IDocumentPartitioner partitioner) {
    if (partitioner == null) {
        if (fDocumentPartitioners != null) {
            fDocumentPartitioners.remove(partitioning);
            if (fDocumentPartitioners.size() == 0)
                fDocumentPartitioners = null;
        }
    } else {
        if (fDocumentPartitioners == null)
            fDocumentPartitioners = new HashMap();
        fDocumentPartitioners.put(partitioning, partitioner);
    }
    DocumentPartitioningChangedEvent event = new DocumentPartitioningChangedEvent(this);
    event.setPartitionChange(partitioning, 0, getLength());
    fireDocumentPartitioningChanged(event);
}
Also used : DocumentPartitioningChangedEvent(org.eclipse.jface.text.DocumentPartitioningChangedEvent) HashMap(java.util.HashMap)

Aggregations

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