cern::gp::actions::support::ContextAction Class Reference

Inheritance diagram for cern::gp::actions::support::ContextAction:
Inheritance graph
[legend]
Collaboration diagram for cern::gp::actions::support::ContextAction:
Collaboration graph
[legend]

List of all members.

Static Public Member Functions

static void setContext (Object ctx)
static Object unsetContext ()

Protected Member Functions

final void performAction (GPNode[] activatedNodes)
abstract void performAction (GPNode[] activatedNodes, Object context)

Static Private Attributes

static WeakReference ref

Detailed Description

An action that contains a context in a static variable.

(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.

Author:
Vito Baggiolini
Version:
Revision
1.2
Date
2006/09/25 08:52:36

Member Function Documentation

abstract void cern::gp::actions::support::ContextAction::performAction ( GPNode[]  activatedNodes,
Object  context 
) [protected, pure virtual]

A method called by GP when you invoke this action. You have to implement this method with the action you want to execute. Please note that the context parameter may be null.

Parameters:
activatedNodes the nodes currently selected
context the object set with setContext(Object) can be null
final void cern::gp::actions::support::ContextAction::performAction ( GPNode[]  activatedNodes  )  [inline, protected, virtual]

the action will be enabled only if the super class enables it and if the context is not null.

See also:
org.openide.util.actions.NodeAction::enable(Node[])

protected boolean enable(Node[] nodes) { return super.enable(nodes) && (ref != null) && (ref.get() != null); }

Implements cern::gp::actions::support::NodeAction.

References ref.

static void cern::gp::actions::support::ContextAction::setContext ( Object  ctx  )  [inline, static]

set a context object. Please remember that Actions are singletons, and therfore this context is shared by all places where this action is used.

Parameters:
ctx the object containing the context

References ref.

static Object cern::gp::actions::support::ContextAction::unsetContext (  )  [inline, static]

Clear the context and return it.

Returns:
the context set. May be null

References ref.


Member Data Documentation

WeakReference cern::gp::actions::support::ContextAction::ref [static, private]

The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2