use of org.eclipse.jface.text.ITextViewerExtension6 in project xtext-eclipse by eclipse.
the class LinkedEditingUndoSupport method undoDocumentChanges.
public void undoDocumentChanges() {
final ISourceViewer viewer = editor.getInternalSourceViewer();
try {
editor.getSite().getWorkbenchWindow().run(false, true, new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (viewer instanceof ITextViewerExtension6) {
IUndoManager undoManager = ((ITextViewerExtension6) viewer).getUndoManager();
if (undoManager instanceof IUndoManagerExtension) {
IUndoManagerExtension undoManagerExtension = (IUndoManagerExtension) undoManager;
IUndoContext undoContext = undoManagerExtension.getUndoContext();
IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory();
while (undoManager.undoable()) {
if (startingUndoOperation != null && startingUndoOperation.equals(operationHistory.getUndoOperation(undoContext)))
return;
undoManager.undo();
}
}
}
}
});
syncUtil.waitForReconciler(editor);
} catch (InterruptedException e) {
// cancelled by user, ok
return;
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
Aggregations