|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.gmf.runtime.common.ui.action.AbstractActionHandler
The abstract parent of all concrete action handlers that execute commands.
Logging and exception handling are done in a uniform way in the
run() method. Concrete subclasses must provide a definition of
the doRun() method to gather any required input and execute a
command. As an implementer of the IRepeatableAction interface,
this class implements the isRepeatable() method to return
true if it is enabled, and implements the
repeat() method to run itself. Subclasses that aren't
repeatable or require special repeat behavior must override the default
implementations of these interface methods.
This action handler supports life cycle methods by implementing the
IDisposableAction interface. Therefore, clients need to call
the init() method to initialize the action, and the
dispose() method when the action is no longer needed.
| Nested Class Summary |
| Nested classes inherited from class org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress |
IActionWithProgress.WorkIndicatorType |
| Field Summary |
| Fields inherited from interface org.eclipse.jface.action.IAction |
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 |
| Constructor Summary | |
protected |
AbstractActionHandler(IWorkbenchPage workbenchPage)
Constructs a new action handler that gets its workbench part by listening to the given workbench page |
protected |
AbstractActionHandler(IWorkbenchPart workbenchPart)
Constructs a new action handler for the specified workbench part. |
| Method Summary | |
protected boolean |
contributedToPart(IWorkbenchPart part)
Answers whether or not I am contributed to part. |
void |
dispose()
Default implementation of dispose. |
protected abstract void |
doRun(IProgressMonitor progressMonitor)
Performs the actual work when this action handler is run. |
protected ActionManager |
getActionManager()
Retrieves the action manager for this action handler from its workbench part. |
java.lang.String |
getLabel()
Retrieves the label for this action handler. |
protected IOperationHistory |
getOperationHistory()
Returns the operation history for this action handler from its action manager. |
protected IPartListener |
getPartListener()
Returns the part listener |
protected ISelection |
getSelection()
Retrieves the current selection. |
protected IStructuredSelection |
getStructuredSelection()
Retrieves the current structured selection. |
protected IUndoContext |
getUndoContext()
Gets the undo context from my workbench part. |
protected IWorkbenchPage |
getWorkbenchPage()
Returns the workbench page |
protected IWorkbenchPart |
getWorkbenchPart()
Retrieves the value of the workbenchPart instance
variable. |
IActionWithProgress.WorkIndicatorType |
getWorkIndicatorType()
Gets type of work indicator (progress monitor, hourglass, or none). |
protected void |
handle(java.lang.Exception exception)
Handles the specified exception. |
void |
historyNotification(OperationHistoryEvent event)
Refreshes me if the history event has my workbench part's context, and the event is one of: OperationHistoryEvent.UNDONE
OperationHistoryEvent.REDONE
OperationHistoryEvent.OPERATION_ADDED
OperationHistoryEvent.OPERATION_CHANGED
OperationHistoryEvent.OPERATION_NOT_OK
OperationHistoryEvent.OPERATION_REMOVED
The other operation history events are ignored because they are
intermediate events that will be followed by one of those listed above.
|
void |
init()
The basic implementation sets the workbenchpart if not already set and refreshes the action if the current part is not null. |
boolean |
isDisposed()
Answers whether or not this action has been disposed and has not been re-initialized. |
protected boolean |
isOperationHistoryListener()
Retrieves a Boolean indicating whether this action handler is interested in operation history changed events. |
protected boolean |
isPropertyListener()
Answers whether of not this action handler is interested in property change events. |
boolean |
isRunnable()
Retrieves a Boolean indicating whether this action handler can be run. |
protected boolean |
isSelectionListener()
Retrieves a Boolean indicating whether this action handler is interested in selection events. |
boolean |
isSetup()
Returns the setup state of this action. |
protected boolean |
needsSetup()
Answers whether or not this action should be setup before it is run. |
protected void |
openErrorDialog(IStatus status)
Opens an error dialog for the specified status object. |
void |
propertyChanged(java.lang.Object source,
int propId)
Property change event handler; does nothing by default. |
void |
run()
|
void |
run(IProgressMonitor progressMonitor)
Runs this action handler. |
void |
runWithEvent(Event event)
Runs this action handler, passing the triggering SWT event. |
void |
selectionChanged(SelectionChangedEvent event)
Notifies this action handler that the selection has changed. |
protected void |
setDisposed(boolean b)
Sets my disposed state. |
void |
setPartSelector(IPartSelector partSelector)
Sets my part selector. |
protected void |
setSetup(boolean setup)
Sets the setup state of this action. |
boolean |
setup()
Sets up the action. |
protected void |
setWorkbenchPart(IWorkbenchPart workbenchPart)
Sets the current workbencgPart |
| Methods inherited from class org.eclipse.jface.action.AbstractAction |
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener |
| Methods inherited from class org.eclipse.core.commands.common.EventManager |
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.jface.action.IAction |
addPropertyChangeListener, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, removePropertyChangeListener, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText |
| Methods inherited from interface org.eclipse.gmf.runtime.common.ui.action.IActionWithProgress |
refresh |
| Constructor Detail |
protected AbstractActionHandler(IWorkbenchPart workbenchPart)
workbenchPart - The workbench part to which this action handler applies.protected AbstractActionHandler(IWorkbenchPage workbenchPage)
workbenchPage - The workbench page associated with this action handler| Method Detail |
public void init()
Any subclass that overrided this method should ensure that the disposed
state of this action is maintained by calling
setDisposed(false) or calling super.init().
init in interface IDisposableActionpublic void dispose()
setDisposed(true) or calling
super.dispose().
dispose in interface IDisposableActionprotected void setWorkbenchPart(IWorkbenchPart workbenchPart)
workbenchPart - The current workbenchPartprotected boolean contributedToPart(IWorkbenchPart part)
part.
part - the workbench part to be tested
true if I am contributed to this part,
false otherwise.public final void setPartSelector(IPartSelector partSelector)
partSelector - my new part selectorprotected final IWorkbenchPart getWorkbenchPart()
workbenchPart instance
variable.
workbenchPart instance variable.protected ActionManager getActionManager()
protected IOperationHistory getOperationHistory()
public void run()
run in interface IActionpublic void run(IProgressMonitor progressMonitor)
run in interface IActionWithProgressprogressMonitor - IProgressMonitor monitoring the execution of this actionpublic void runWithEvent(Event event)
runWithEvent in interface IActionevent - The SWT event which triggered this action being run.public final void selectionChanged(SelectionChangedEvent event)
selectionChanged in interface ISelectionChangedListenerevent - Event object describing the change.
public void propertyChanged(java.lang.Object source,
int propId)
propertyChanged in interface IPropertyListenerpublic java.lang.String getLabel()
getLabel in interface IActionWithProgressprotected ISelection getSelection()
protected IStructuredSelection getStructuredSelection()
public boolean isRunnable()
isRunnable in interface IActionWithProgresstrue if this action handler is enabled;
false otherwise.protected boolean isSelectionListener()
true if this action handler is interested;
false otherwise.protected boolean isPropertyListener()
This default implementation always returns false.
Subclasses must override if they are interested in property change
events.
true if this action handler is interested;
false otherwise.protected boolean isOperationHistoryListener()
true if this action handler is interested;
false otherwise.protected void handle(java.lang.Exception exception)
exception - The exception to be handled.protected void openErrorDialog(IStatus status)
status - The status object for which to open an error dialog.protected abstract void doRun(IProgressMonitor progressMonitor)
progressMonitor - the progress monitor for tracking the progress of this action
when it is run.public IActionWithProgress.WorkIndicatorType getWorkIndicatorType()
IActionWithProgress
getWorkIndicatorType in interface IActionWithProgressprotected IPartListener getPartListener()
protected IWorkbenchPage getWorkbenchPage()
public void historyNotification(OperationHistoryEvent event)
OperationHistoryEvent.UNDONEOperationHistoryEvent.REDONEOperationHistoryEvent.OPERATION_ADDEDOperationHistoryEvent.OPERATION_CHANGEDOperationHistoryEvent.OPERATION_NOT_OKOperationHistoryEvent.OPERATION_REMOVED
historyNotification in interface IOperationHistoryListenerprotected IUndoContext getUndoContext()
public boolean isDisposed()
IDisposableAction
isDisposed in interface IDisposableActiontrue if the action has been disposed,
false otherwise.protected void setDisposed(boolean b)
b - true if I am disposed, false
otherwise.public boolean setup()
IActionWithProgressIActionWithProgress.run(IProgressMonitor) is called.
setup in interface IActionWithProgresstrue if the setup completed successfully,
false otherwise.public boolean isSetup()
true if the action has been setup,
false otherwise.protected void setSetup(boolean setup)
setup - true if the action has been setup,
false otherwise.protected boolean needsSetup()
true if the action has a setup, false
otherwise.
|
Runtime | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.