|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.commands.operations.AbstractOperation
org.eclipse.gmf.runtime.common.core.command.AbstractCommand
public abstract class AbstractCommand
An abstract superclass for GMF IUndoableOperation
s that do not
modify EMF model resources.
The operation provides a list of IFile
s that are expected to be modified when
the operation is executed, undone or redone. An IOperationApprover
is
registered with the OperationHistoryFactory.getOperationHistory()
to
validate the modification to these resources.
This class is meant to be extended by clients.
ICommand
Constructor Summary | |
---|---|
AbstractCommand(java.lang.String label)
Initializes me with a label. |
|
AbstractCommand(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, undone or redone. |
Method Summary | |
---|---|
ICommand |
compose(IUndoableOperation operation)
Returns a new command object that represents a composition of this command with the specified command parameter. |
void |
dispose()
|
protected abstract CommandResult |
doExecuteWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Performs the actual work of executing this command. |
protected abstract CommandResult |
doRedoWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Performs the actual work of redoing this command. |
protected abstract CommandResult |
doUndoWithResult(IProgressMonitor progressMonitor,
IAdaptable info)
Performs the actual work of undoing this command. |
IStatus |
execute(IProgressMonitor progressMonitor,
IAdaptable info)
Delegates to doExecuteWithResult(IProgressMonitor, IAdaptable) and sets
the command result. |
java.util.List |
getAffectedFiles()
Returns the IFile s that may be modified when the operation is
executed, undone or redone. |
CommandResult |
getCommandResult()
Retrieves the result of executing, undoing, or redoing this command, depending on which of these operations was last performed. |
void |
internalSetResult(CommandResult result)
Deprecated. internal API |
IStatus |
redo(IProgressMonitor progressMonitor,
IAdaptable info)
Delegates to doRedoWithResult(IProgressMonitor, IAdaptable) and sets the
command result. |
ICommand |
reduce()
Returns the simplest form of this command that is equivalent. |
protected void |
setResult(CommandResult result)
Sets the command result. |
IStatus |
undo(IProgressMonitor progressMonitor,
IAdaptable info)
Delegates to doUndoWithResult(IProgressMonitor, IAdaptable) and sets the
command result. |
Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation |
---|
addContext, canExecute, canRedo, canUndo, getContexts, getLabel, hasContext, removeContext, setLabel, toString |
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 |
Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation |
---|
addContext, canExecute, canRedo, canUndo, getContexts, getLabel, hasContext, removeContext |
Constructor Detail |
---|
public AbstractCommand(java.lang.String label)
label
- the operation label, should never be null
.public AbstractCommand(java.lang.String label, java.util.List affectedFiles)
IFile
s that anticipate modifying
when I am executed, undone or redone.
label
- the operation label, should never be null
.affectedFiles
- the list of affected IFile
s; may be null
Method Detail |
---|
public java.util.List getAffectedFiles()
IFile
s that may be modified when the operation is
executed, undone or redone.
getAffectedFiles
in interface ICommand
IFile
s that will be modifiedpublic CommandResult getCommandResult()
ICommand
null
if the operation has no meaningful result.
The value of this result is undefined if the command has not yet been executed, undone or redone.
getCommandResult
in interface ICommand
protected final void setResult(CommandResult result)
result
- the new result for this command.public ICommand compose(IUndoableOperation operation)
ICommand
command
parameter.
compose
in interface ICommand
operation
- The operation that is to be composed with this command.
public ICommand reduce()
ICommand
reduce
in interface ICommand
public IStatus execute(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
doExecuteWithResult(IProgressMonitor, IAdaptable)
and sets
the command result.
execute
in interface IUndoableOperation
execute
in class AbstractOperation
ExecutionException
protected abstract CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
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.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException
- if, for some reason, I fail to complete the operationpublic IStatus redo(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
doRedoWithResult(IProgressMonitor, IAdaptable)
and sets the
command result.
redo
in interface IUndoableOperation
redo
in class AbstractOperation
ExecutionException
protected abstract CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
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.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException
- on failure to redopublic IStatus undo(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
doUndoWithResult(IProgressMonitor, IAdaptable)
and sets the
command result.
undo
in interface IUndoableOperation
undo
in class AbstractOperation
ExecutionException
protected abstract CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException
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.
null
if the execution status is OK, but there is no meaningful result
to be returned.
ExecutionException
- on failure to undopublic void dispose()
dispose
in interface IUndoableOperation
dispose
in class AbstractOperation
public void internalSetResult(CommandResult result)
internalSetResult
in interface org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult
result
- CommandResult to set
|
Runtime | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.