Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.jdeveloper.controller
Class NodeActionController

java.lang.Object
  extended by oracle.jdeveloper.controller.NodeActionController
All Implemented Interfaces:
Controller

public class NodeActionController
extends java.lang.Object
implements Controller

A controller which executes an action on one or more nodes using subclass- specific delegates.

The controller expects the action to provide two string properties: a template string to compute the label for a context with a single selection (action key SINGLE_SELECTION_TEMPLATE_TEXT); and a string used to for a context with a multiple selection (action key MULTIPLE_SELECTION_TEXT). The update(oracle.ide.controller.IdeAction, oracle.ide.Context) method uses these strings to update the action name (action key Action.NAME) to reflect the current context. (The action name is the string typically displayed by menu items and buttons tied to the action.) Note that if these strings are not supplied, the controller will still function decently.

While the semantics of Context are tighter than they used to be, the selection semantics are still a little nebulous. This controller assumes, among other things, that all the elements of a selection are either nodes or node containers, or else are elements contained by a single node.

See Also:
NodeActionDelegate

Field Summary
static java.lang.String MULTIPLE_SELECTION_TEXT
          Action property key for the text of the context-dependent action name for a context containing multiple selected elements.
static java.lang.String SINGLE_SELECTION_TEMPLATE_TEXT
          Action property key for the template text used to compute the context-dependent action name for a context containing a single selected element.
 
Fields inherited from interface oracle.ide.controller.Controller
UPDATE_FROM_ACTION_PERFORMED, UPDATE_FROM_ACTIVE_VIEW_CHANGED, UPDATE_FROM_UNDO, UPDATE_FROM_USER_EXTENSION, UPDATE_FROM_VIEW_SELECTION_CHANGED
 
Constructor Summary
NodeActionController()
           
 
Method Summary
 void addDelegate(java.lang.Class nodeClass, java.lang.Class delegateClass)
          Adds a NodeActionDelegate to this controller.
protected  NodeActionDelegate getDelegate(Node node)
           
 boolean handleEvent(IdeAction action, Context context)
          This method is called when a user interaction with a View triggers the execution of a command.
protected  void queueContainer(Element element, Project project, Workspace workspace, IdeAction action, java.util.Map queue)
           
 boolean update(IdeAction action, Context context)
          This method updates the enabled status of the specified action within the specified context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLE_SELECTION_TEMPLATE_TEXT

public static final java.lang.String SINGLE_SELECTION_TEMPLATE_TEXT
Action property key for the template text used to compute the context-dependent action name for a context containing a single selected element. The name is computed by substituting the name of the selected element for any occurrence in the template of the substring "{0}".

See Also:
Constant Field Values

MULTIPLE_SELECTION_TEXT

public static final java.lang.String MULTIPLE_SELECTION_TEXT
Action property key for the text of the context-dependent action name for a context containing multiple selected elements.

See Also:
Constant Field Values
Constructor Detail

NodeActionController

public NodeActionController()
Method Detail

addDelegate

public void addDelegate(java.lang.Class nodeClass,
                        java.lang.Class delegateClass)
Adds a NodeActionDelegate to this controller.


update

public boolean update(IdeAction action,
                      Context context)
This method updates the enabled status of the specified action within the specified context. It should generally be called on the controller associated with the active view to allow that controller to take the first crack at determining its enabled status. If that controller wants to update its enabled status, it does so and returns true to indicate that further controllers do not need to be consulted. If the controller does not deal with setting the enabled status of an action, it delegates the request to its supervising controller, all the way up to the Ide. The Ide has a special implementation of update(xx) that further delegates the request to root controllers, until one of them returns true indicating the request was handled by the controller.

Updates the state of an action to reflect the context.

Specified by:
update in interface Controller
Parameters:
action - action whose command is to be executed.
context - the current context
Returns:
true if the controller handles the specified command.

handleEvent

public boolean handleEvent(IdeAction action,
                           Context context)
This method is called when a user interaction with a View triggers the execution of a command.

Executes the controlled action through the delegates.

Specified by:
handleEvent in interface Controller
Parameters:
action - action whose command is to be executed.
Returns:
true if the controller handles the specified command.

getDelegate

protected NodeActionDelegate getDelegate(Node node)

queueContainer

protected void queueContainer(Element element,
                              Project project,
                              Workspace workspace,
                              IdeAction action,
                              java.util.Map queue)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.