Runtime

org.eclipse.gmf.runtime.common.core.command
Interface ICommand

All Superinterfaces:
IUndoableOperation
All Known Subinterfaces:
ICompositeCommand
All Known Implementing Classes:
AbstractCommand, AbstractTransactionalCommand, CompositeCommand, CompositeTransactionalCommand

public interface ICommand
extends IUndoableOperation

A self-composing undoable operation that has a CommandResult and a list of affected IFiles.

Executing, undoing or redoing a command can have a result which clients can obtain by using the ICommand.getCommandResult() method. For example, executing a command that create a new entity may wish to make the new entity accessible to clients through the ICommand.getCommandResult() method.

The command provides a list of IFiles that are expected to be modified when the it is executed, undone or redone. An IOperationApprover is registered with the OperationHistoryFactory.getOperationHistory() to validate the modification to these resources.

If an error occurs, or the progress monitor is canceled during execute, undo or redo, the command should make every effort to roll back the changes it has made up to that point.


Method Summary
 ICommand compose(IUndoableOperation operation)
          Returns a new command object that represents a composition of this command with the specified command parameter.
 java.util.List getAffectedFiles()
          Returns the list of IFiles that are expected to be modified by this command.
 CommandResult getCommandResult()
          Retrieves the result of executing, undoing, or redoing this command, depending on which of these operations was last performed.
 ICommand reduce()
          Returns the simplest form of this command that is equivalent.
 
Methods inherited from interface org.eclipse.core.commands.operations.IUndoableOperation
addContext, canExecute, canRedo, canUndo, dispose, execute, getContexts, getLabel, hasContext, redo, removeContext, undo
 

Method Detail

getCommandResult

public CommandResult getCommandResult()
Retrieves the result of executing, undoing, or redoing this command, depending on which of these operations was last performed. This value can be 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.

Returns:
The result of executing, undoing or redoing this command.

getAffectedFiles

public java.util.List getAffectedFiles()
Returns the list of IFiles that are expected to be modified by this command.

Returns:
the list of IFiles that will be modified

compose

public ICommand compose(IUndoableOperation operation)
Returns a new command object that represents a composition of this command with the specified command parameter.

Parameters:
operation - The operation that is to be composed with this command.
Returns:
A command that represents a composition of this command with the specified command.

reduce

public ICommand reduce()
Returns the simplest form of this command that is equivalent. Use this method to remove unnecessary nesting of commands.

Returns:
the simplest form of this command that is equivalent

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.