org.eclipse.gmf.runtime.common.core.command
Class OneTimeCommand
java.lang.Object
org.eclipse.core.commands.operations.AbstractOperation
org.eclipse.gmf.runtime.common.core.command.AbstractCommand
org.eclipse.gmf.runtime.common.core.command.OneTimeCommand
-
All Implemented Interfaces:
-
IUndoableOperation,
ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult
-
public abstract class OneTimeCommand
- extends
AbstractCommand
A command does its work once, and can never be undone or redone. It does not do
any work that invalidates the undo history in a linear undo model.
By default, it is assigned the NULL_CONTEXT
when it is
constructed, and no other contexts can be added to it or removed from it.
This class is meant to be subclassed by clients who have work to do in a
command that should have no effect on the operation history.
Constructor Summary
|
OneTimeCommand
(java.lang.String label)
Initializes me with a label. |
OneTimeCommand
(java.lang.String label,
java.util.List affectedFiles)
Initializes me with a label and a list of
IFile s that anticipate
modifying when I am executed. |
Methods inherited from class org.eclipse.gmf.runtime.common.core.command.
AbstractCommand
|
compose,
dispose,
doExecuteWithResult,
execute,
getAffectedFiles,
getCommandResult,
internalSetResult,
redo,
reduce,
setResult,
undo
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
|
Methods inherited from interface org.eclipse.gmf.runtime.common.core.command.
ICommand
|
setLabel
|
NULL_CONTEXT
protected static final
IUndoContext NULL_CONTEXT
- The null undo context.
OneTimeCommand
public OneTimeCommand(java.lang.String label)
- Initializes me with a label.
-
Parameters:
-
label
- the operation label
OneTimeCommand
public OneTimeCommand(java.lang.String label,
java.util.List affectedFiles)
- Initializes me with a label and a list of
IFile
s that anticipate
modifying when I am executed.
-
Parameters:
-
label
- the operation label -
affectedFiles
- the list of affected
IFile
s; may be null
addContext
public final void addContext(
IUndoContext context)
- Does nothing. The context will not be added to the operation.
-
-
Specified by:
-
addContext
in interface
IUndoableOperation
-
Overrides:
-
addContext
in class
AbstractOperation
-
removeContext
public final void removeContext(
IUndoContext context)
- Does nothing. The context will not be removed from the operation.
-
-
Specified by:
-
removeContext
in interface
IUndoableOperation
-
Overrides:
-
removeContext
in class
AbstractOperation
-
canUndo
public final boolean canUndo()
- Not undoable. Returns
false
.
-
-
Specified by:
-
canUndo
in interface
IUndoableOperation
-
Overrides:
-
canUndo
in class
AbstractOperation
-
canRedo
public final boolean canRedo()
- Not redoable. Returns
false
.
-
-
Specified by:
-
canRedo
in interface
IUndoableOperation
-
Overrides:
-
canRedo
in class
AbstractOperation
-
doUndoWithResult
protected final
CommandResult doUndoWithResult(
IProgressMonitor progressMonitor,
IAdaptable info)
throws
ExecutionException
- Not undoable. Throws an ExecutionException.
-
-
Specified by:
-
doUndoWithResult
in class
AbstractCommand
-
-
Parameters:
-
progressMonitor
- the progress monitor provided by the operation history. Must
never be null
. -
info
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class.
-
Returns:
- The result of undoing this command. May be
null
if the execution status is OK, but there is no meaningful result
to be returned.
-
Throws:
-
ExecutionException
- on failure to undo
doRedoWithResult
protected final
CommandResult doRedoWithResult(
IProgressMonitor progressMonitor,
IAdaptable info)
throws
ExecutionException
- Not redoable. Throws an ExecutionException.
-
-
Specified by:
-
doRedoWithResult
in class
AbstractCommand
-
-
Parameters:
-
progressMonitor
- the progress monitor provided by the operation history. Must
never be null
. -
info
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it should minimally contain an adapter
for the org.eclipse.swt.widgets.Shell.class.
-
Returns:
- The result of redoing this command. May be
null
if the execution status is OK, but there is no meaningful result
to be returned.
-
Throws:
-
ExecutionException
- on failure to redo
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.