|
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.emf.workspace.AbstractEMFOperation
org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand
public abstract class AbstractTransactionalCommand
An abstract superclass for GMF IUndoableOperation
s that 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.
Subclasses must return the command execution result in their implementation
of doExecuteWithResult(IProgressMonitor, IAdaptable)
.
This class is meant to be extended by clients.
Constructor Summary | |
---|---|
AbstractTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
java.lang.String label,
java.util.List affectedFiles)
Initializes me with the editing domain in which I am making model changes, a label, and a list of IFile s that I anticipate
modifying when I am executed, undone or redone. |
|
AbstractTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain,
java.lang.String label,
java.util.Map options,
java.util.List affectedFiles)
Initializes me with the editing domain, a label, transaction options, and a list of IFile s that anticipate modifying when I am executed,
undone or redone. |
Method Summary | |
---|---|
protected IStatus |
aggregateStatuses(java.util.List statuses)
Considers that the aggregate status may be different from the present status, and updates the command result accordingly. |
protected void |
cleanup()
Subclasses may implement this method to dispose of objects that were required for execution, but are no longer require to undo or redo this operation. |
ICommand |
compose(IUndoableOperation operation)
Returns a new command object that represents a composition of this command with the specified command parameter. |
protected void |
didRedo(org.eclipse.emf.transaction.Transaction tx)
|
protected void |
didUndo(org.eclipse.emf.transaction.Transaction tx)
|
protected IStatus |
doExecute(IProgressMonitor monitor,
IAdaptable info)
Delegates to doExecuteWithResult(IProgressMonitor, IAdaptable)
to perform the model changes. |
protected abstract CommandResult |
doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info)
Implemented by subclasses to perform the model changes. |
protected IStatus |
doRedo(IProgressMonitor monitor,
IAdaptable info)
Overrides superclass to set the command result. |
protected IStatus |
doUndo(IProgressMonitor monitor,
IAdaptable info)
Overrides superclass to set the command result. |
java.util.List |
getAffectedFiles()
Returns the IFile s for resources 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. |
protected static java.util.List |
getWorkspaceFiles(org.eclipse.emf.ecore.EObject eObject)
Convenience method to get a list of workspaces files associated with eObject . |
protected static java.util.List |
getWorkspaceFiles(java.util.List eObjects)
Convenience method to get a list of workspaces files associated with EObject s in eObject . |
void |
internalSetResult(CommandResult result)
Deprecated. internal API |
ICommand |
reduce()
Returns the simplest form of this command that is equivalent. |
protected void |
setResult(CommandResult result)
Sets the command result. |
Methods inherited from class org.eclipse.emf.workspace.AbstractEMFOperation |
---|
canRedo, canUndo, didCommit, dispose, execute, getChange, getEditingDomain, getOptions, redo, undo |
Methods inherited from class org.eclipse.core.commands.operations.AbstractOperation |
---|
addContext, canExecute, 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, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo |
Constructor Detail |
---|
public AbstractTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label, java.util.List affectedFiles)
IFile
s that I anticipate
modifying when I am executed, undone or redone.
domain
- my editing domainlabel
- my user-readable label, should never be null
.affectedFiles
- the list of affected IFile
s; may be null
public AbstractTransactionalCommand(org.eclipse.emf.transaction.TransactionalEditingDomain domain, java.lang.String label, java.util.Map options, java.util.List affectedFiles)
IFile
s that anticipate modifying when I am executed,
undone or redone.
domain
- my editing domainlabel
- my user-readable label, should never be null
.options
- for the transaction in which I execute myself, or
null
for the default optionsaffectedFiles
- the list of affected IFile
s; may be null
Method Detail |
---|
protected static java.util.List getWorkspaceFiles(org.eclipse.emf.ecore.EObject eObject)
eObject
.
eObject
- the model object, may be null
IFile
sprotected static java.util.List getWorkspaceFiles(java.util.List eObjects)
EObject
s in eObject
.
eObjects
- the list of model object
IFile
spublic java.util.List getAffectedFiles()
IFile
s for resources that may be modified when the
operation is executed, undone or redone.
getAffectedFiles
in interface ICommand
IFile
s that will be modifiedpublic final 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
protected abstract CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
monitor
- the progress monitor provided by the operation historyinfo
- the adaptable provided by the operation history
ExecutionException
- if, for some reason, I fail to complete
the operationprotected void didUndo(org.eclipse.emf.transaction.Transaction tx)
didUndo
in class org.eclipse.emf.workspace.AbstractEMFOperation
protected void didRedo(org.eclipse.emf.transaction.Transaction tx)
didRedo
in class org.eclipse.emf.workspace.AbstractEMFOperation
protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
doExecuteWithResult(IProgressMonitor, IAdaptable)
to perform the model changes. Sets the command result and calls
cleanup()
to give subclasses a chance to dispose of any objects
that were required for the execution but will not be required for undo or
redo.
doExecute
in class org.eclipse.emf.workspace.AbstractEMFOperation
ExecutionException
protected IStatus doUndo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
doUndo
in class org.eclipse.emf.workspace.AbstractEMFOperation
ExecutionException
protected IStatus doRedo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
doRedo
in class org.eclipse.emf.workspace.AbstractEMFOperation
ExecutionException
protected IStatus aggregateStatuses(java.util.List statuses)
aggregateStatuses
in class org.eclipse.emf.workspace.AbstractEMFOperation
protected void cleanup()
This method is invoked at the end of
doExecute(IProgressMonitor, IAdaptable)
.
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.