Package org.eclipse.ui.actions
Class PartEventAction
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.jface.action.AbstractAction
org.eclipse.jface.action.Action
org.eclipse.ui.actions.PartEventAction
- All Implemented Interfaces:
IAction
,IPartListener
- Direct Known Subclasses:
PageEventAction
,RetargetAction
The abstract superclass for actions that listen to part activation and
open/close events. This implementation tracks the active part (see
getActivePart
) and provides a convenient place to monitor part
lifecycle events that could affect the availability of the action.
Subclasses must implement the following IAction
method:
run
- to do the action's work
Subclasses may extend any of the IPartListener
methods if the
action availablity needs to be recalculated:
partActivated
partDeactivated
partOpened
partClosed
partBroughtToTop
Although this method implements the IPartListener
interface, it
does NOT register itself.
-
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
ModifierConstructorDescriptionprotected
PartEventAction
(String text) Creates a new action with the given text.protected
PartEventAction
(String text, int style) Creates a new action with the given text and style. -
Method Summary
Modifier and TypeMethodDescriptionReturns the currently active part in the workbench.void
partActivated
(IWorkbenchPart part) ThePartEventAction
implementation of thisIPartListener
method records that the given part is active.void
ThePartEventAction
implementation of thisIPartListener
method does nothing.void
partClosed
(IWorkbenchPart part) ThePartEventAction
implementation of thisIPartListener
method clears the active part if it just closed.void
ThePartEventAction
implementation of thisIPartListener
method records that there is no active part.void
partOpened
(IWorkbenchPart part) ThePartEventAction
implementation of thisIPartListener
method does nothing.Methods inherited from class org.eclipse.jface.action.Action
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, run, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, 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
-
PartEventAction
Creates a new action with the given text.- Parameters:
text
- the action's text, ornull
if there is no text
-
PartEventAction
Creates a new action with the given text and style.- Parameters:
text
- the action's text, ornull
if there is no textstyle
- one ofAS_PUSH_BUTTON
,AS_CHECK_BOX
,AS_DROP_DOWN_MENU
,AS_RADIO_BUTTON
, andAS_UNSPECIFIED
- Since:
- 3.0
-
-
Method Details
-
getActivePart
Returns the currently active part in the workbench.- Returns:
- currently active part in the workbench, or
null
if none
-
partActivated
ThePartEventAction
implementation of thisIPartListener
method records that the given part is active. Subclasses may extend this method if action availability has to be recalculated.- Specified by:
partActivated
in interfaceIPartListener
- Parameters:
part
- the part that was activated- See Also:
-
partBroughtToTop
ThePartEventAction
implementation of thisIPartListener
method does nothing. Subclasses should extend this method if action availability has to be recalculated.- Specified by:
partBroughtToTop
in interfaceIPartListener
- Parameters:
part
- the part that was surfaced- See Also:
-
partClosed
ThePartEventAction
implementation of thisIPartListener
method clears the active part if it just closed. Subclasses may extend this method if action availability has to be recalculated.- Specified by:
partClosed
in interfaceIPartListener
- Parameters:
part
- the part that was closed- See Also:
-
partDeactivated
ThePartEventAction
implementation of thisIPartListener
method records that there is no active part. Subclasses may extend this method if action availability has to be recalculated.- Specified by:
partDeactivated
in interfaceIPartListener
- Parameters:
part
- the part that was deactivated- See Also:
-
partOpened
ThePartEventAction
implementation of thisIPartListener
method does nothing. Subclasses should extend this method if action availability has to be recalculated.- Specified by:
partOpened
in interfaceIPartListener
- Parameters:
part
- the part that was opened- See Also:
-