Skip navigation links

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

E52944-01


oracle.jdeveloper.controller
Class JavaSourceNodeActionDelegate

java.lang.Object
  extended by oracle.jdeveloper.controller.NodeActionDelegate
      extended by oracle.jdeveloper.controller.JavaSourceNodeActionDelegate


public abstract class JavaSourceNodeActionDelegate
extends NodeActionDelegate

Constructor Summary
JavaSourceNodeActionDelegate()
           

 

Method Summary
 int[] doAction(Context context, Element[] elements, int[] text, IdeAction action)
          Does the action on a Node.
protected abstract  int[] doAction(SourceFile file, Context context, Element[] elements, int[] text, IdeAction action)
          Does the action on a SourceFile.
 boolean isEnabled(IdeAction action, Context context, Element[] elements, int[] text)
          Gets whether an action is enabled for a Node selection.
 void undoAction(Context context, Element[] elements, int[] text, IdeAction action)
          Undoes the action on a node.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

JavaSourceNodeActionDelegate

public JavaSourceNodeActionDelegate()

Method Detail

isEnabled

public boolean isEnabled(IdeAction action,
                         Context context,
                         Element[] elements,
                         int[] text)
Gets whether an action is enabled for a Node selection. As handled by the NodeActionController.update(oracle.ide.controller.IdeAction, oracle.ide.Context) method, the selection represents either the whole node, Elements within a node (e.g., in a structure pane), or a text range within a code editor. The context argument specifies the node and its containing project and workspace. The elements specifies elements selected within the node, or null if none. The text argument specifies the start (inclusive) and end (excluse) offset of the selection, or null if none. If this method returns false, the update method disables the action. If this method returns true, and NodeActionDelegate.isEnabled(oracle.ide.controller.IdeAction, oracle.ide.Context, oracle.ide.model.Element[], int[]) for any other nodes in the selection also returns true, the update method enables the action. The default NodeActionDelegate implementation returns true.

Because this method is invoked from the NodeActionController.update(oracle.ide.controller.IdeAction, oracle.ide.Context) method, it should avoid time-consuming computations.

The default JavaSourceNodeActionDelegate implementation returns true only if the context has a non-null project.

Overrides:
isEnabled in class NodeActionDelegate
Parameters:
action - The IDE action to be updated.
context - An IDE context specifying the node, project, and workspace.
elements - An array of Elements specifying the selected elements within the node, or null if none.
text - A two element int array specifying the start and end offsets of the selected text within the node, or null if none.
Returns:
true if the action should be enabled for the node.

doAction

public int[] doAction(Context context,
                      Element[] elements,
                      int[] text,
                      IdeAction action)
Description copied from class: NodeActionDelegate
Does the action on a Node. This method is invoked on a background thread and should not, in general, invoke any Swing or UI methods.
Specified by:
doAction in class NodeActionDelegate
Parameters:
context - An IDE context specifying the node, project, and workspace.
elements - An array of Elements specifying the selected elements within the node, or null if none.
text - A two element int array specifying the start and end offsets of the selected text within the node, or null if none.
action - The IDE action to do.
Returns:
a two-element int array specifying the start and end offsets of the text to select after the action is done, or null if none.

doAction

protected abstract int[] doAction(SourceFile file,
                                  Context context,
                                  Element[] elements,
                                  int[] text,
                                  IdeAction action)
Does the action on a SourceFile. This method is not invoked when the command is redone. This method is invoked on a background thread and should not, in general, invoke any Swing or UI methods.
Parameters:
file - The SourceFile, write locked and in a transaction.
context - An IDE context specifying the node, project, and workspace.
elements - An array of Elements specifying the selected elements within the node, or null if none.
text - A two-element int array specifying the start and end offsets of the selected text within the node, or null if none.
action - The IDE action to do.
Returns:
a two-element int array specifying the start and end offsets of the text to select after the action is done, or null if none.

undoAction

public void undoAction(Context context,
                       Element[] elements,
                       int[] text,
                       IdeAction action)
Description copied from class: NodeActionDelegate
Undoes the action on a node.
Specified by:
undoAction in class NodeActionDelegate
Parameters:
context - An IDE context specifying the node, project, and workspace.
elements - An array of Elements specifying the selected elements within the node, or null if none.
text - A two element int array specifying the start and end offset
action - The IDE action to undo.

Skip navigation links

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

E52944-01


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