1 2 3 4 5 6 7 8 9 10 11 12 13 14
| IUndoContext undoContext= PlatformUI.getWorkbench().getOperationSupport().getUndoContext();
if (undoContext != null) {
// Use actions provided by global undo/redo
// Create the undo action
OperationHistoryActionHandler undoAction= new UndoActionHandler(getEditor().getSite(), undoContext);
undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO);
actionBars.setGlobalActionHandler(ITextEditorActionConstants.UNDO, undoAction);
// Create the redo action.
OperationHistoryActionHandler redoAction= new RedoActionHandler(getEditor().getSite(), undoContext);
redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO);
actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, redoAction);
} |
Partager