public abstract class OperationHistoryActionHandler extends Action implements ActionFactory.IWorkbenchAction, IAdaptable
OperationHistoryActionHandler implements common behavior for the undo and redo actions. It supports filtering of undo or redo on a particular undo context. If an undo context is not specified, or there has been no history available for the specified undo context, then the workbench undo context will be used.
OperationHistoryActionHandler provides an adapter in the info parameter of the IOperationHistory undo and redo methods that is used to get UI info for prompting the user during operations or operation approval. Adapters are provided for org.eclipse.ui.IWorkbenchWindow, org.eclipse.swt.widgets.Shell, org.eclipse.ui.IWorkbenchPart, org.eclipse.core.commands.IUndoContext, and org.eclipse.runtime.IProgressMonitor.
OperationHistoryActionHandler assumes a linear undo/redo model. When the handler is run, the operation history is asked to perform the most recent undo/redo for the handler's undo context. The handler can be configured (using #setPruneHistory(true)) to flush the operation undo or redo history for the handler's undo context when there is no valid operation on top of the history. This avoids keeping a stale history of invalid operations. By default, pruning does not occur and it is assumed that clients of the particular undo context are pruning the history when necessary.
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes of this action.
|
Object |
getAdapter(Class adapter)
Returns an object which is an instance of the given class
associated with this object.
|
void |
run()
The default implementation of this
IAction method does
nothing. |
void |
setContext(IUndoContext context)
Set the context shown by the handler.
|
void |
setPruneHistory(boolean prune)
Specify whether the action handler should actively prune the operation
history when invalid operations are encountered.
|
void |
update()
Update enabling and labels according to the current status of the
operation history.
|
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
public void dispose()
ActionFactory.IWorkbenchAction
dispose
in interface ActionFactory.IWorkbenchAction
public final void run()
Action
IAction
method does
nothing. Subclasses should override this method if they do not need
information from the triggering event, or override
runWithEvent(Event)
if they do.run
in interface IAction
run
in class Action
How radio buttons are handled
,
How check boxes are handled
public Object getAdapter(Class adapter)
IAdaptable
null
if
no such object can be found.getAdapter
in interface IAdaptable
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classpublic void setContext(IUndoContext context)
context
- the context to be used for the undo historypublic void setPruneHistory(boolean prune)
false
.prune
- true
if the history should be pruned by the
handler, and false
if it should not.public void update()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.