1 11 package org.eclipse.ui.operations; 12 13 import org.eclipse.core.commands.ExecutionException; 14 import org.eclipse.core.commands.operations.IUndoContext; 15 import org.eclipse.core.commands.operations.IUndoableOperation; 16 import org.eclipse.core.runtime.IProgressMonitor; 17 import org.eclipse.core.runtime.IStatus; 18 import org.eclipse.ui.ISharedImages; 19 import org.eclipse.ui.IWorkbenchPartSite; 20 import org.eclipse.ui.PlatformUI; 21 import org.eclipse.ui.internal.WorkbenchMessages; 22 23 32 public final class RedoActionHandler extends OperationHistoryActionHandler { 33 34 43 public RedoActionHandler(IWorkbenchPartSite site, IUndoContext context) { 44 super(site, context); 45 setImageDescriptor(PlatformUI.getWorkbench().getSharedImages() 46 .getImageDescriptor(ISharedImages.IMG_TOOL_REDO)); 47 setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages() 48 .getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED)); 49 } 50 51 void flush() { 52 getHistory().dispose(getUndoContext(), false, true, false); 53 } 54 55 String getCommandString() { 56 return WorkbenchMessages.Operations_redoCommand; 57 } 58 59 String getTooltipString() { 60 return WorkbenchMessages.Operations_redoTooltipCommand; 61 } 62 63 String getSimpleCommandString() { 64 return WorkbenchMessages.Workbench_redo; 65 } 66 67 String getSimpleTooltipString() { 68 return WorkbenchMessages.Workbench_redoToolTip; 69 } 70 71 72 IUndoableOperation getOperation() { 73 return getHistory().getRedoOperation(getUndoContext()); 74 } 75 76 IStatus runCommand(IProgressMonitor pm) throws ExecutionException { 77 return getHistory().redo(getUndoContext(), pm, this); 78 } 79 80 boolean shouldBeEnabled() { 81 return getHistory().canRedo(getUndoContext()); 82 } 83 } 84 | Popular Tags |