Java Code Examples for org.eclipse.core.commands.operations.IOperationHistory#getUndoHistory()
The following examples show how to use
org.eclipse.core.commands.operations.IOperationHistory#getUndoHistory() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UndoCommandHandler.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public boolean isEnabled() { final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor() ; if(editor != null){ final IOperationHistory history = (IOperationHistory) editor.getAdapter(IOperationHistory.class); final IUndoContext context = (IUndoContext) editor.getAdapter(IUndoContext.class); if(history != null && context != null){ final IUndoableOperation[] undoHistory = history.getUndoHistory(context); if (undoHistory != null && undoHistory.length != 0) { final IUndoableOperation ctxt = undoHistory[undoHistory.length - 1]; final String ctxtLabel = ctxt.getLabel(); if(ctxtLabel != null && ctxtLabel.contains("Lane")){//Avoid Exception on undo //$NON-NLS-1$ return false ; } else { return ctxt.canUndo(); } } } else { return false; } } return false; }