public abstract class PartEventAction extends Action implements IPartListener
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.
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
Modifier | Constructor and Description |
---|---|
protected |
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.
|
Modifier and Type | Method and Description |
---|---|
IWorkbenchPart |
getActivePart()
Returns the currently active part in the workbench.
|
void |
partActivated(IWorkbenchPart part)
The
PartEventAction implementation of this
IPartListener method records that the given part is active. |
void |
partBroughtToTop(IWorkbenchPart part)
The
PartEventAction implementation of this
IPartListener method does nothing. |
void |
partClosed(IWorkbenchPart part)
The
PartEventAction implementation of this
IPartListener method clears the active part if it just closed. |
void |
partDeactivated(IWorkbenchPart part)
The
PartEventAction implementation of this
IPartListener method records that there is no active part. |
void |
partOpened(IWorkbenchPart part)
The
PartEventAction implementation of this
IPartListener method does nothing. |
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
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
protected PartEventAction(String text)
text
- the action's text, or null
if there is no textprotected PartEventAction(String text, int style)
text
- the action's text, or null
if there is no textstyle
- one of AS_PUSH_BUTTON
, AS_CHECK_BOX
,
AS_DROP_DOWN_MENU
, AS_RADIO_BUTTON
, and
AS_UNSPECIFIED
public IWorkbenchPart getActivePart()
null
if nonepublic void partActivated(IWorkbenchPart part)
PartEventAction
implementation of this
IPartListener
method records that the given part is active.
Subclasses may extend this method if action availability has to be
recalculated.partActivated
in interface IPartListener
part
- the part that was activatedIWorkbenchPage.activate(org.eclipse.ui.IWorkbenchPart)
public void partBroughtToTop(IWorkbenchPart part)
PartEventAction
implementation of this
IPartListener
method does nothing. Subclasses should extend
this method if action availability has to be recalculated.partBroughtToTop
in interface IPartListener
part
- the part that was surfacedIWorkbenchPage.bringToTop(org.eclipse.ui.IWorkbenchPart)
public void partClosed(IWorkbenchPart part)
PartEventAction
implementation of this
IPartListener
method clears the active part if it just closed.
Subclasses may extend this method if action availability has to be
recalculated.partClosed
in interface IPartListener
part
- the part that was closedIWorkbenchPage.hideView(IViewPart)
public void partDeactivated(IWorkbenchPart part)
PartEventAction
implementation of this
IPartListener
method records that there is no active part.
Subclasses may extend this method if action availability has to be
recalculated.partDeactivated
in interface IPartListener
part
- the part that was deactivatedIWorkbenchPage.activate(IWorkbenchPart)
public void partOpened(IWorkbenchPart part)
PartEventAction
implementation of this
IPartListener
method does nothing. Subclasses should extend
this method if action availability has to be recalculated.partOpened
in interface IPartListener
part
- the part that was openedIWorkbenchPage.showView(String)
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.