use of org.eclipse.jface.text.IDocumentExtension4 in project che by eclipse.
the class MultiStateTextFileChange method performChangesInSynchronizationContext.
private void performChangesInSynchronizationContext(final IDocument document, final LinkedList undoList, final boolean preview) throws BadLocationException {
DocumentRewriteSession session = null;
try {
if (document instanceof IDocumentExtension4)
session = ((IDocumentExtension4) document).startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED);
for (final Iterator iterator = fChanges.iterator(); iterator.hasNext(); ) {
final ComposableBufferChange change = (ComposableBufferChange) iterator.next();
final UndoEdit edit = createTextEditProcessor(change, document, undoList != null ? TextEdit.CREATE_UNDO : TextEdit.NONE, preview).performEdits();
if (undoList != null)
undoList.addFirst(edit);
}
} finally {
if (session != null)
((IDocumentExtension4) document).stopRewriteSession(session);
}
}
Aggregations