|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.emf.edit.ui.action.CommandAction
This class is used to implement a selection-based IAction on the menubar, the toolbar, or a popup menu
by delegating all required behaviour to a Command.
All aspects of the action are delegated,
namely the enablement state, the menu text, the toolbar icon, and the help tip text.
A derived class implements createActionCommand
to return a command based on the EditingDomain and the collection of selected objects.
This class can also be used to implement actions not based on a selection,
in that case the method selectionChanged should be overriden to do nothing.
| Field Summary | |
protected IAction |
action
This records the proxy action created by the platform. |
protected Collection |
collection
This records the collection of selected objects so that a new command can be easily constructed after the execution of the command previously constructed from this selection. |
protected Command |
command
This records the command that is created each time the selection changes. |
protected EditingDomain |
editingDomain
This records the editing domain of the current editor. |
protected IEditorPart |
editorPart
Deprecated. As of EMF 2.1.0, replaced by workbenchPart. |
protected IWorkbenchPart |
workbenchPart
This records the editor or view with which the action is currently associated. |
| Constructor Summary | |
CommandAction()
This constructs an instance. |
|
| Method Summary | |
protected Command |
createActionCommand(EditingDomain editingDomain,
Collection collection)
This method must be implemented to create the command for this action, given the editing domain and the collection of selected objects. |
void |
dispose()
This is called when this action delegate is no longer needed. |
protected ImageDescriptor |
getDefaultImageDescriptor()
This returns the image descriptor if the command does not provide an override. |
void |
init(IAction action)
This is called immediately after this action delegate is created. |
void |
init(IViewPart view)
For view actions, the framework calls this when the view is shown, so that we can connect with it. |
protected ImageDescriptor |
objectToImageDescriptor(Object object)
|
void |
run(IAction action)
The action must have been enabled for this to have been called, so we must have stored the selection already by this point. |
void |
runWithEvent(IAction action,
Event event)
Because we implement IActionDelegate2, this is called instead of the old run.
|
void |
selectionChanged(IAction action,
ISelection selection)
This is invoked by the framework so that the action state can be updated. |
void |
setActiveEditor(IAction action,
IEditorPart editorPart)
For editor actions, the framework calls this when the active editor changes, so that we can connect with it. |
void |
setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
This records the specified workbench part, and if it is an editing domain provider, its editing domain. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected IWorkbenchPart workbenchPart
protected IEditorPart editorPart
workbenchPart.
protected IAction action
protected EditingDomain editingDomain
protected Collection collection
protected Command command
| Constructor Detail |
public CommandAction()
| Method Detail |
protected Command createActionCommand(EditingDomain editingDomain,
Collection collection)
protected ImageDescriptor getDefaultImageDescriptor()
public void init(IAction action)
init in interface IActionDelegate2public void dispose()
dispose in interface IActionDelegate2
public void setActiveEditor(IAction action,
IEditorPart editorPart)
setActiveWorkbenchPart(org.eclipse.ui.IWorkbenchPart) to record it and its editing domain, if it can provide one.
setActiveEditor in interface IEditorActionDelegatepublic void init(IViewPart view)
setActiveWorkbenchPart(org.eclipse.ui.IWorkbenchPart) to record it and its editing domain, if it can provide one.
init in interface IViewActionDelegatepublic void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
public void runWithEvent(IAction action,
Event event)
IActionDelegate2, this is called instead of the old run.
This simply calls that method, which must be invokved since a subclass may have overridden it.
runWithEvent in interface IActionDelegate2public void run(IAction action)
run in interface IActionDelegate
public void selectionChanged(IAction action,
ISelection selection)
selectionChanged in interface IActionDelegateprotected ImageDescriptor objectToImageDescriptor(Object object)
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||