@SuppressWarnings("deprecation") protected void attachModel(IEditorInput input, IWorkbenchPartSite site) { copyAttributes(cutHandler, ActionFactory.CUT); copyAttributes(copyHandler, ActionFactory.COPY); copyAttributes(pasteHandler, ActionFactory.PASTE); // copyAttributes(pasteSpecialHandler, EnsembleActionFactory.PASTE_SPECIAL); copyAttributes(deleteHandler, ActionFactory.DELETE); copyAttributes(selectAllHandler, ActionFactory.SELECT_ALL); getEditorSite().getKeyBindingService(); // Editors need to bind keyboard actions IUndoContext undoContext = getUndoContext(); undoHandler = new UndoActionHandler(site, undoContext); redoHandler = new RedoActionHandler(site, undoContext); cutHandler.init(site, undoContext); copyHandler.init(site, undoContext); pasteHandler.init(site, undoContext); // pasteSpecialHandler.setUndoContext(undoContext); deleteHandler.init(site, undoContext); updateHandlerEnablements(); }
private void installUndoRedoSupport() { IUndoContext undoContext = ((IUndoManagerExtension) queryViewer.getUndoManager()).getUndoContext(); UndoActionHandler undoAction = new UndoActionHandler(getSite(), undoContext); RedoActionHandler redoAction = new RedoActionHandler(getSite(), undoContext); undoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_UNDO); redoAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_REDO); IActionBars actionBars = getEditor().getEditorSite().getActionBars(); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); actionBars.updateActionBars(); }
private void fillActionBars(IActionBars actionBars) { // toolbarManager.add(new Separator(ITerrainEditor.TOOLBAR_VIEWOPTIONS)); // toolbarManager.add(new Separator(ITerrainEditor.TOOLBAR_TOOLS)); IAction undoAction = new UndoActionHandler(getSite(), MapOperation.MapContext.INSTANCE); IAction redoAction = new RedoActionHandler(getSite(), MapOperation.MapContext.INSTANCE); actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction); actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction); }