- All Superinterfaces:
- Action, ActionListener, EventListener
- All Known Implementing Classes:
public interface ContextAwareAction
- extends Action
Interface to be implemented by an action whose behavior
is dependent on some context.
The action created by
is bound to the provided context:
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
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.
- See Also:
Action createContextAwareInstance(Lookup actionContext)
- Creates action instance for provided context.
actionContext - an arbitrary context (e.g. "cookies" from a node selection)
- a transient action whose behavior applies only to that context