|
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 IUndoableOperations that modify EMF
model resources.
The operation provides a list of IFiles 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(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 IFiles that I anticipate
modifying when I am executed, undone or redone. |
|
AbstractTransactionalCommand(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 IFiles 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(Transaction tx)
|
protected void |
didUndo(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 IFiles 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(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 EObjects 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(TransactionalEditingDomain domain,
java.lang.String label,
java.util.List affectedFiles)
IFiles that I anticipate
modifying when I am executed, undone or redone.
domain - my editing domainlabel - my user-readable labelaffectedFiles - the list of affected IFiles; may be null
public AbstractTransactionalCommand(TransactionalEditingDomain domain,
java.lang.String label,
java.util.Map options,
java.util.List affectedFiles)
IFiles that anticipate modifying when I am executed,
undone or redone.
domain - my editing domainlabel - my user-readable labeloptions - for the transaction in which I execute myself, or
null for the default optionsaffectedFiles - the list of affected IFiles; may be null| Method Detail |
|---|
protected static java.util.List getWorkspaceFiles(EObject eObject)
eObject.
eObject - the model object, may be null
IFilesprotected static java.util.List getWorkspaceFiles(java.util.List eObjects)
EObjects in eObject.
eObjects - the list of model object
IFilespublic java.util.List getAffectedFiles()
IFiles for resources that may be modified when the
operation is executed, undone or redone.
getAffectedFiles in interface ICommandIFiles that will be modifiedpublic final CommandResult getCommandResult()
ICommandnull 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 ICommandprotected final void setResult(CommandResult result)
result - the new result for this command.public ICommand compose(IUndoableOperation operation)
ICommandcommand parameter.
compose in interface ICommandoperation - 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(Transaction tx)
didUndo in class AbstractEMFOperationprotected void didRedo(Transaction tx)
didRedo in class 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 AbstractEMFOperationExecutionException
protected IStatus doUndo(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
doUndo in class AbstractEMFOperationExecutionException
protected IStatus doRedo(IProgressMonitor monitor,
IAdaptable info)
throws ExecutionException
doRedo in class AbstractEMFOperationExecutionExceptionprotected IStatus aggregateStatuses(java.util.List statuses)
aggregateStatuses in class AbstractEMFOperationprotected 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.ICommandWithSettableResultresult - 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.