Runtime

## org.eclipse.gmf.runtime.common.core.command
Class IdentityCommand

    java.lang.Object
      org.eclipse.core.commands.operations.AbstractOperation
          org.eclipse.gmf.runtime.common.core.command.AbstractCommand
              org.eclipse.gmf.runtime.common.core.command.IdentityCommand

All Implemented Interfaces:
  IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

    public final class IdentityCommand

extends AbstractCommand

A command that is always executable, undoable and redoable, but does nothing. It always returns the same OK command result.

Field Summary
`static IdentityCommand` `INSTANCE` The singleton instance.

Method Summary
`protected CommandResult` `doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Does nothing and returns an OK command result.
`protected CommandResult` `doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Does nothing and returns an OK command result.
`protected CommandResult` `doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info)` Does nothing and returns an OK command result.

Methods inherited from class org.eclipse.gmf.runtime.common.core.command.AbstractCommand
`compose, dispose, execute, getAffectedFiles, getCommandResult, internalSetResult, redo, reduce, setResult, undo`

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`

Field Detail

### INSTANCE

    public static final IdentityCommand INSTANCE

  The singleton instance.

Method Detail

### doExecuteWithResult

    protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor,
                                                IAdaptable info)
                                         throws ExecutionException

  Does nothing and returns an OK command result.

  Specified by:
    `doExecuteWithResult` 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 executing this command. May be `null` if the execution status is OK, but there is no meaningful result to be returned.
  Throws:
    `ExecutionException` - if, for some reason, I fail to complete the operation

### doRedoWithResult

    protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor,
                                             IAdaptable info)
                                      throws ExecutionException

  Does nothing and returns an OK command result.

  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

### doUndoWithResult

    protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor,
                                             IAdaptable info)
                                      throws ExecutionException

  Does nothing and returns an OK command result.

  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

Runtime

Guidelines for using Eclipse APIs.

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