1 11 package org.eclipse.ui.operations; 12 13 import org.eclipse.core.commands.operations.IUndoContext; 14 import org.eclipse.ui.IActionBars; 15 import org.eclipse.ui.IWorkbenchPartSite; 16 import org.eclipse.ui.actions.ActionFactory; 17 import org.eclipse.ui.actions.ActionGroup; 18 19 30 public final class UndoRedoActionGroup extends ActionGroup { 31 32 private UndoActionHandler undoActionHandler; 33 34 private RedoActionHandler redoActionHandler; 35 36 50 public UndoRedoActionGroup(IWorkbenchPartSite site, 51 IUndoContext undoContext, boolean pruneHistory) { 52 53 undoActionHandler = new UndoActionHandler(site, undoContext); 55 undoActionHandler.setPruneHistory(pruneHistory); 56 57 redoActionHandler = new RedoActionHandler(site, undoContext); 59 redoActionHandler.setPruneHistory(pruneHistory); 60 } 61 62 67 public void fillActionBars(IActionBars actionBars) { 68 super.fillActionBars(actionBars); 69 if (undoActionHandler != null) { 70 actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), 71 undoActionHandler); 72 actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), 73 redoActionHandler); 74 } 75 } 76 } 77 | Popular Tags |