public abstract class CookieAction extends NodeAction
<file name="action-pkg-ClassName.instance"> <attr name="type" stringvalue="org.netbeans.api.actions.Openable"/> <attr name="delegate" methodvalue="org.openide.awt.Action.inject"/> <attr name="selectionType" stringvalue="ANY"/> <attr name="injectable" stringvalue="pkg.YourClass"/> <attr name="displayName" bundlevalue="your.pkg.Bundle#key"/> <attr name="iconBase" stringvalue="your/pkg/YourImage.png"/> <!-- if desired: <attr name="noIconInMenu" boolvalue="false"/> --> </file>
| Modifier and Type | Field | Description |
|---|---|---|
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.
|
| Constructor | Description |
|---|---|
CookieAction() |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract java.lang.Class<?>[] |
cookieClasses() |
Get the cookies that this action requires.
|
javax.swing.Action |
createContextAwareInstance(org.openide.util.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.
|
accept, addPropertyChangeListener, getValue, putValue, removePropertyChangeListenerasynchronous, getMenuPresenter, getPopupPresenter, getToolbarPresenteractionPerformed, addNotify, getActivatedNodes, initialize, isEnabled, performAction, performAction, removeNotify, setEnabled, surviveFocusChangeclone, getClass, notify, notifyAll, toString, wait, wait, waitpublic static final int MODE_ONE
public static final int MODE_SOME
public static final int MODE_ALL
public static final int MODE_EXACTLY_ONE
public static final int MODE_ANY
protected abstract int mode()
MODE_XXX
constants.protected abstract java.lang.Class<?>[] cookieClasses()
protected boolean enable(Node[] activatedNodes)
cookieClasses() and mode() to specify
the enablement logic.enable in class NodeActionactivatedNodes - the set of activated nodestrue to enablepublic javax.swing.Action createContextAwareInstance(org.openide.util.Lookup actionContext)
ContextAwareAction interface method.createContextAwareInstance in class NodeActionactionContext - a lookup contains action context, cannot be nullBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.