public abstract class Action extends java.lang.Object implements java.awt.event.ActionListener, java.lang.Cloneable, java.lang.Comparable<Action>
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
action |
protected javax.swing.JComponent |
cmItem |
protected ProjectViewer |
viewer |
Modifier | Constructor and Description |
---|---|
protected |
Action()
Creates a regular action.
|
protected |
Action(java.lang.String action)
Creates an action tied to an action name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones the current action, returning a copy of it.
|
int |
compareTo(Action other)
Compares this action with another.
|
boolean |
equals(java.lang.Object o)
Implementation of equals() so that it's consistent with
compareTo(Action) . |
javax.swing.JComponent |
getMenuItem()
Returns the menu item that triggers this action.
|
abstract java.lang.String |
getText()
Returns a String that will be shown as the text of the menu item or
the tooltip of the toolbar button.
|
void |
prepareForNode(VPTNode node)
When a node is selected (for the toolbar button) or when the context
menu is shown (for the menu item), this method is called and the
selected node is passed, so the action can choose whether the action
will be available or not for that node.
|
void |
setViewer(ProjectViewer viewer)
Sets the viewer where this action is being used.
|
protected ProjectViewer viewer
protected javax.swing.JComponent cmItem
protected java.lang.String action
protected Action()
protected Action(java.lang.String action)
public abstract java.lang.String getText()
public void prepareForNode(VPTNode node)
By default, does nothing.
node
- The selected node, or null
if multiple
nodes are selected.public javax.swing.JComponent getMenuItem()
public java.lang.Object clone()
clone
in class java.lang.Object
public void setViewer(ProjectViewer viewer)
public int compareTo(Action other)
getText()
.compareTo
in interface java.lang.Comparable<Action>
other
- Action to compare to.Comparable.compareTo(Object)
).public boolean equals(java.lang.Object o)
compareTo(Action)
.equals
in class java.lang.Object