|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.jdeveloper.controller.NodeActionDelegate
public abstract class NodeActionDelegate
An abstract delegate which implements a generic action for Node
s of a
specific class.
doAction(oracle.ide.Context, oracle.ide.model.Element[], int[], oracle.ide.controller.IdeAction)
and
#undo
. If additional state, beyond the node class, needs to be
considered when determining whether the action should be enabled,
#isEnabledNode
should also be overridden.
To specifically perform actions on Element
and/or text selections
within a node, #isEnabledElements
and #doElements
and/or #isEnabledText
and #doText
should be overridden.
Delegates classes must have a public, no-argument constructor and are
registered through the NodeActionController.addDelegate(java.lang.Class, java.lang.Class)
method.
Both the do
and the undo methods are invoked
in a background thread and they should not use the command
processor, or invoke methods that use the command processor. Some
convenience subclasses are provided for commands which use text buffers,
the Java model, or the XML model.
The Context
s passed to the delegate specifies the node being
processed, the workspace and project which contains it, and the view
copied from the context passed to the controller.
NodeActionController
,
TextNodeActionDelegate
,
JavaSourceNodeActionDelegate
,
XmlSourceNodeActionDelegate
Constructor Summary | |
---|---|
NodeActionDelegate()
|
Method Summary | |
---|---|
abstract int[] |
doAction(Context context,
Element[] elements,
int[] text,
IdeAction action)
Does the action on a Node . |
boolean |
isEnabled(IdeAction action,
Context context,
Element[] elements,
int[] text)
Gets whether an action is enabled for a Node selection. |
abstract 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 |
---|
public NodeActionDelegate()
Method Detail |
---|
public boolean isEnabled(IdeAction action, Context context, Element[] elements, int[] text)
Node
selection. As
handled by the NodeActionController.update(oracle.ide.controller.IdeAction, oracle.ide.Context)
method, the selection
represents either the whole node, Element
s 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
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.
action
- The IDE action to be updated.context
- An IDE context specifying the node, project, and workspace.elements
- An array of Element
s 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.
public abstract int[] doAction(Context context, Element[] elements, int[] text, IdeAction action) throws java.lang.Exception
Node
. This method is invoked on
a background thread and should not, in general, invoke any Swing or
UI methods.
context
- An IDE context specifying the node, project, and workspace.elements
- An array of Element
s 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.
java.lang.Exception
public abstract void undoAction(Context context, Element[] elements, int[] text, IdeAction action)
context
- An IDE context specifying the node, project, and workspace.elements
- An array of Element
s specifying the selected
elements within the node, or null if none.text
- A two element int array specifying the start and end offsetaction
- The IDE action to undo.
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.6.0) E13403-07 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |