|
|||||||||||
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 returns the action to which we are delegating our action properties. |
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
When the action is used as an editor part (for the menubar and toolbar), this records the current editor. |
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. |
protected ImageDescriptor |
getDefaultImageDescriptor()
This returns the image descriptor if the command does not provide an override. |
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 |
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)
The framework calls this so that we can register against this editor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected IEditorPart editorPart
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 setActiveEditor(IAction action, IEditorPart editorPart)
setActiveEditor
in interface IEditorActionDelegate
public void run(IAction action)
run
in interface IActionDelegate
public void selectionChanged(IAction action, ISelection selection)
selectionChanged
in interface IActionDelegate
protected ImageDescriptor objectToImageDescriptor(Object object)
|
Copyright 2001-2004 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |