Package org.eclipse.ui.internal
Class WWinPluginAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.ui.internal.PluginAction
org.eclipse.ui.internal.WWinPluginAction
- All Implemented Interfaces:
EventListener
,IAction
,ISelectionChangedListener
,IActionSetContributionItem
,INullSelectionListener
,IPluginContribution
,ISelectionListener
- Direct Known Subclasses:
WWinPluginPulldown
This class extends regular plugin action with the additional requirement that
the delegate has to implement interface
IWorkbenchWindowActionDelegate
. This interface has one
additional method (init) whose purpose is to initialize the delegate with the
window in which the action is intended to run.-
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
ConstructorDescriptionWWinPluginAction
(IConfigurationElement actionElement, IWorkbenchWindow window, String id, int style) Constructs a newWWinPluginAction
object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Disposes of the action and any resources held.Returns the action set id.protected void
Initialize the action delegate by calling its lifecycle method.boolean
Returns true if the window has been set.static void
Creates any actions which belong to an activated plugin.protected void
Refresh the selection for the action.void
runWithEvent
(Event event) The default implementation of thisIAction
method ignores the event argument, and simply callsrun()
.void
setActionSetId
(String newActionSetId) Sets the action set id.void
setChecked
(boolean checked) Sets the checked status of this action.void
setHelpListener
(HelpListener listener) TheWWinPluginAction
implementation of this method declared onIAction
stores the help listener in a local field.toString()
protected IActionDelegate
validateDelegate
(Object obj) Validates the object is a delegate of the expected type.Methods inherited from class org.eclipse.ui.internal.PluginAction
createDelegate, disposeDelegate, getConfigElement, getDelegate, getLocalId, getMenuCreator, getOverrideActionId, getPluginId, getSelection, refreshEnablement, run, selectionChanged, selectionChanged, selectionChanged
Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, setAccelerator, setActionDefinitionId, setDescription, setDisabledImageDescriptor, setEnabled, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipText
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
-
Constructor Details
-
WWinPluginAction
public WWinPluginAction(IConfigurationElement actionElement, IWorkbenchWindow window, String id, int style) Constructs a newWWinPluginAction
object.- Parameters:
actionElement
- the configuration elementwindow
- the window to contribute toid
- the identifierstyle
- the style
-
-
Method Details
-
refreshActionList
public static void refreshActionList()Creates any actions which belong to an activated plugin. -
validateDelegate
Description copied from class:PluginAction
Validates the object is a delegate of the expected type. Subclasses can override to check for specific delegate types.Note: Calls to the object are not allowed during this method.
- Overrides:
validateDelegate
in classPluginAction
- Parameters:
obj
- a possible action delegate implementation- Returns:
- the
IActionDelegate
implementation for the object - Throws:
WorkbenchException
- if not of the expected delegate type
-
initDelegate
protected void initDelegate()Description copied from class:PluginAction
Initialize the action delegate by calling its lifecycle method. Subclasses may override but must call this implementation first.- Overrides:
initDelegate
in classPluginAction
-
dispose
public void dispose()Disposes of the action and any resources held.- Overrides:
dispose
in classPluginAction
-
getActionSetId
Returns the action set id.- Specified by:
getActionSetId
in interfaceIActionSetContributionItem
-
isOkToCreateDelegate
public boolean isOkToCreateDelegate()Returns true if the window has been set. The window may be null after the constructor is called and before the window is stored. We cannot create the delegate at that time.- Overrides:
isOkToCreateDelegate
in classPluginAction
-
runWithEvent
Description copied from class:Action
The default implementation of thisIAction
method ignores the event argument, and simply callsrun()
. Subclasses should override this method if they need information from the triggering event, or overriderun()
if not.- Specified by:
runWithEvent
in interfaceIAction
- Overrides:
runWithEvent
in classPluginAction
- Parameters:
event
- the SWT event which triggered this action being run- See Also:
-
setActionSetId
Sets the action set id.- Specified by:
setActionSetId
in interfaceIActionSetContributionItem
-
setHelpListener
TheWWinPluginAction
implementation of this method declared onIAction
stores the help listener in a local field. The supplied listener is only used if there is no retarget action.- Specified by:
setHelpListener
in interfaceIAction
- Overrides:
setHelpListener
in classAction
- Parameters:
listener
- a help listener for this action
-
setChecked
public void setChecked(boolean checked) Description copied from interface:IAction
Sets the checked status of this action. Applicable for the stylesAS_CHECK_BOX
orAS_RADIO_BUTTON
.Fires a property change event for the
CHECKED
property if the checked status actually changes as a consequence.- Specified by:
setChecked
in interfaceIAction
- Overrides:
setChecked
in classAction
- Parameters:
checked
- the new checked status- See Also:
-
refreshSelection
protected void refreshSelection()Refresh the selection for the action. -
toString
-