public class RevertNodeCommand extends Command
RevertNodeCommand
is used to revert the contents of a node to its persistent storage, and to send the appropriate notification. This command cannot be undone.Command
Constructor and Description |
---|
RevertNodeCommand()
Constructs a new
RevertNodeCommand to run without confirmation. |
RevertNodeCommand(boolean confirm)
Constructs a new
RevertNodeCommand to run with optional confirmation. |
Modifier and Type | Method and Description |
---|---|
int |
doit()
Executes the actions associated with the revert command to revert the specified node.
|
boolean |
isNeedConfirm()
Returns
true if the command requires user confirmation before executing, otherwise returns false . |
static int |
reload(Context context)
Utility method to reload the Node specified in the context with confirmation; the Node must be an instance of
Node . |
static int |
reload(Context context, boolean confirm)
Utility method to reload the Node specified in the context with optional confirmation; the Node must be an instance of
Node . |
static int |
reload(Node node)
Utility method to reload a specified
Node without confirmation. |
static int |
reload(Node node, boolean confirm)
Utility method to reload a specified
Node with optional confirmation. |
void |
setNeedConfirm(boolean confirm)
Sets whether the command requires user confirmation before executing.
|
enableConfirmation, getAffectedNodes, getContext, getData, getId, getName, getProgressHandle, getType, isGlobal, setContext, setData, setTaskInfo, undo
public RevertNodeCommand()
RevertNodeCommand
to run without confirmation. This command cannot be undone.public RevertNodeCommand(boolean confirm)
RevertNodeCommand
to run with optional confirmation. This command cannot be undone.confirm
- if true
, a confirmation dialog is displayed before the command is executed; if false
, the command is run without confirmationpublic int doit() throws java.lang.Exception
doit
in class Command
Command.OK
if the reload was successful, otherwise Command.CANCEL
java.lang.Exception
public boolean isNeedConfirm()
true
if the command requires user confirmation before executing, otherwise returns false
.public void setNeedConfirm(boolean confirm)
confirm
- if true
, a confirmation dialog is displayed before the command is executed; if false
, the command is run without confirmationpublic static int reload(Node node)
Node
without confirmation.node
- the Node
to reloadCommand.OK
if the reload was successful, otherwise Command.CANCEL
public static int reload(Node node, boolean confirm)
Node
with optional confirmation.node
- the Node
to reloadconfirm
- if true
, a confirmation dialog is displayed; if false
, the Node
is reloaded without confirmationCommand.OK
if the reload was successful, otherwise Command.CANCEL
public static int reload(Context context)
Node
.context
- the Context
containing the Node to be reloaded.Command.OK
if the reload was successful, otherwise Command.CANCEL
public static int reload(Context context, boolean confirm)
Node
.context
- the Context
containing the Node to be reloaded.confirm
- if true
, a confirmation dialog is displayed; if false
, the Node
is reloaded without confirmationCommand.OK
if the reload was successful, otherwise Command.CANCEL
Context.getNode()