Runtime

org.eclipse.gmf.runtime.common.core.command
Class UnexecutableCommand

java.lang.Object
  extended by org.eclipse.core.commands.operations.AbstractOperation
      extended by org.eclipse.gmf.runtime.common.core.command.AbstractCommand
          extended by org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand
All Implemented Interfaces:
IUndoableOperation, ICommand, org.eclipse.gmf.runtime.common.core.internal.command.ICommandWithSettableResult

public class UnexecutableCommand
extends AbstractCommand

A command that cannot be executed. This is an implementation of the Null Object pattern that can be used to provide a command object that can't be executed to clients who require an ICommand.


Field Summary
static UnexecutableCommand INSTANCE
          The singleton instance.
 
Constructor Summary
protected UnexecutableCommand()
          Creates an instance of an unexecutable command.
 
Method Summary
 boolean canExecute()
           
 boolean canRedo()
           
 boolean canUndo()
           
protected  CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info)
          Performs the actual work of executing this command.
protected  CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info)
          Performs the actual work of redoing this command.
protected  CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info)
          Performs the actual work of undoing this command.
 
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, 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, getContexts, getLabel, hasContext, removeContext
 

Field Detail

INSTANCE

public static final UnexecutableCommand INSTANCE
The singleton instance.

Constructor Detail

UnexecutableCommand

protected UnexecutableCommand()
Creates an instance of an unexecutable command.

Method Detail

doExecuteWithResult

protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor,
                                            IAdaptable info)
                                     throws ExecutionException
Description copied from class: AbstractCommand
Performs the actual work of executing this command. Subclasses must implement this method to perform some operation.

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:
java.lang.UnsupportedOperationException
ExecutionException - if, for some reason, I fail to complete the operation

doRedoWithResult

protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor,
                                         IAdaptable info)
                                  throws ExecutionException
Description copied from class: AbstractCommand
Performs the actual work of redoing this command. Subclasses must implement this method to perform the redo.

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:
java.lang.UnsupportedOperationException
ExecutionException - on failure to redo

doUndoWithResult

protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor,
                                         IAdaptable info)
                                  throws ExecutionException
Description copied from class: AbstractCommand
Performs the actual work of undoing this command. Subclasses must implement this method to perform the undo.

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:
java.lang.UnsupportedOperationException
ExecutionException - on failure to undo

canExecute

public boolean canExecute()
Specified by:
canExecute in interface IUndoableOperation
Overrides:
canExecute in class AbstractOperation
Returns:
false.

canRedo

public boolean canRedo()
Specified by:
canRedo in interface IUndoableOperation
Overrides:
canRedo in class AbstractOperation
Returns:
false.

canUndo

public boolean canUndo()
Specified by:
canUndo in interface IUndoableOperation
Overrides:
canUndo in class AbstractOperation
Returns:
false.

Runtime

Guidelines for using Eclipse APIs.

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