public abstract class ContextAction extends NodeAction
(The implementation uses a weak reference and to help you avoid memory leaks.) Please remember that GP (NetBeans) actions are singletons, and you are not supposed to instantiate them.
| Constructor and Description |
|---|
ContextAction() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
performAction(GPNode[] activatedNodes)
the action will be enabled only if the super class enables it
and if the context is not null.
|
protected abstract void |
performAction(GPNode[] activatedNodes,
java.lang.Object context)
A method called by GP when you invoke this action.
|
static void |
setContext(java.lang.Object ctx)
set a context object.
|
static java.lang.Object |
unsetContext()
Clear the context and return it.
|
createJButton, enable, getHelpCtx, getName, iconResource, surviveFocusChangepublic static void setContext(java.lang.Object ctx)
ctx - the object containing the contextpublic static java.lang.Object unsetContext()
protected final void performAction(GPNode[] activatedNodes)
performAction in class NodeActionactivatedNodes - gives array of actually activated nodes.protected boolean enable(Node[] nodes) {
return super.enable(nodes) && (ref != null) && (ref.get() != null);
}protected abstract void performAction(GPNode[] activatedNodes, java.lang.Object context)
activatedNodes - the nodes currently selectedcontext - the object set with setContext(Object) can be null