Action
, ActionListener
, EventListener
CallbackSystemAction
public interface ContextAwareAction extends Action
createContextAwareInstance(org.openide.util.Lookup)
is bound to the provided context: Action.isEnabled()
,
ActionListener.actionPerformed(java.awt.event.ActionEvent)
, etc. may be specific to that context.
For example, the action representing a context menu item will usually implement this interface. When the actual context menu is created, rather than making a presenter for the generic action, the menu will contain a presenter for the context-aware instance. The context will then be taken from the GUI environment where the context menu was shown; for example it may be a TopComponent's context, often taken from an activated node selection. The context action might be enabled only if a certain "cookie" is present in that selection. When invoked, the action need not search for an object to act on, since it can use the context.
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Modifier and Type | Method | Description |
---|---|---|
Action |
createContextAwareInstance(org.openide.util.Lookup actionContext) |
Creates action instance for provided context.
|
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
actionPerformed
Action createContextAwareInstance(org.openide.util.Lookup actionContext)
actionContext
- an arbitrary context (e.g. "cookies" from a node selection)Built on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.