当前页面:
在线文档首页 >
NetBeans API Javadoc 5.5.0
CookieAction (NetBeans Nodes API) - NetBeans API Javadoc 5.5.0
org.openide.util.actions
Class CookieAction
java.lang.Object
org.openide.util.SharedClassObject
org.openide.util.actions.SystemAction
org.openide.util.actions.CallableSystemAction
org.openide.util.actions.NodeAction
org.openide.util.actions.CookieAction
- All Implemented Interfaces:
- ActionListener, Externalizable, Serializable, EventListener, Action, Presenter, Presenter.Menu, Presenter.Popup, Presenter.Toolbar, ContextAwareAction, HelpCtx.Provider
public abstract class CookieAction
- extends NodeAction
An action
dependent on the cookies of the selected nodes.
- See Also:
- Serialized Form
Field Summary |
static int |
MODE_ALL
Action will be enabled if there are one or more selected nodes
and all of them support the given cookies. |
static int |
MODE_ANY
Action will be enabled if there are one or more selected nodes
and any of them (one, all, or some) support the given cookies. |
static int |
MODE_EXACTLY_ONE
Action will be enabled if there is exactly one selected node
and it supports the given cookies. |
static int |
MODE_ONE
Action will be enabled if there are one or more selected nodes
and there is exactly one node which supports the given cookies. |
static int |
MODE_SOME
Action will be enabled if there are several selected nodes
and some of them (at least one, but not all)
support the given cookies. |
Method Summary |
protected abstract Class[] |
cookieClasses()
Get the cookies that this action requires. |
Action |
createContextAwareInstance(Lookup actionContext)
Implements ContextAwareAction interface method. |
protected boolean |
enable(Node[] activatedNodes)
Test for enablement based on the cookies of selected nodes. |
protected abstract int |
mode()
Get the mode of the action: how strict it should be about
cookie support. |
Methods inherited from class org.openide.util.actions.SystemAction |
clearSharedData, createPopupMenu, createToolbarPresenter, get, getHelpCtx, getIcon, getIcon, getName, getValue, iconResource, linkActions, putValue, setIcon |
Methods inherited from class org.openide.util.SharedClassObject |
addPropertyChangeListener, equals, finalize, findObject, findObject, firePropertyChange, getLock, getProperty, hashCode, putProperty, putProperty, readExternal, removePropertyChangeListener, reset, writeExternal, writeReplace |
MODE_ONE
public static final int MODE_ONE
- Action will be enabled if there are one or more selected nodes
and there is exactly one node which supports the given cookies.
- See Also:
- Constant Field Values
MODE_SOME
public static final int MODE_SOME
- Action will be enabled if there are several selected nodes
and some of them (at least one, but not all)
support the given cookies.
- See Also:
- Constant Field Values
MODE_ALL
public static final int MODE_ALL
- Action will be enabled if there are one or more selected nodes
and all of them support the given cookies.
- See Also:
- Constant Field Values
MODE_EXACTLY_ONE
public static final int MODE_EXACTLY_ONE
- Action will be enabled if there is exactly one selected node
and it supports the given cookies.
- See Also:
- Constant Field Values
MODE_ANY
public static final int MODE_ANY
- Action will be enabled if there are one or more selected nodes
and any of them (one, all, or some) support the given cookies.
- See Also:
- Constant Field Values
CookieAction
public CookieAction()
mode
protected abstract int mode()
- Get the mode of the action: how strict it should be about
cookie support.
- Returns:
- the mode of the action. Possible values are disjunctions of the
MODE_XXX
constants.
cookieClasses
protected abstract Class[] cookieClasses()
- Get the cookies that this action requires. The cookies are disjunctive, i.e. a node
must support AT LEAST ONE of the cookies specified by this method.
- Returns:
- a list of cookies
enable
protected boolean enable(Node[] activatedNodes)
- Test for enablement based on the cookies of selected nodes.
Generally subclasses should not override this except for strange
purposes, and then only calling the super method and adding a check.
Just use
cookieClasses()
and mode()
to specify
the enablement logic.
- Specified by:
enable
in class NodeAction
- Parameters:
activatedNodes
- the set of activated nodes
- Returns:
true
to enable
createContextAwareInstance
public Action createContextAwareInstance(Lookup actionContext)
- Implements
ContextAwareAction
interface method.
- Specified by:
createContextAwareInstance
in interface ContextAwareAction
- Overrides:
createContextAwareInstance
in class NodeAction