public abstract class JavaSourceNodeActionDelegate extends NodeActionDelegate
| Constructor and Description |
|---|
JavaSourceNodeActionDelegate() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
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, 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.
isEnabled in class NodeActionDelegateaction - 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.public int[] doAction(Context context, Element[] elements, int[] text, IdeAction action)
NodeActionDelegateNode. This method is invoked on
a background thread and should not, in general, invoke any Swing or
UI methods.doAction in class NodeActionDelegatecontext - 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.protected abstract int[] doAction(SourceFile file, Context context, Element[] elements, int[] text, IdeAction action)
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.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.public void undoAction(Context context, Element[] elements, int[] text, IdeAction action)
NodeActionDelegateundoAction in class NodeActionDelegatecontext - 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 offsetaction - The IDE action to undo.