org.eclipse.emf.edit.command
Interface OverrideableCommand

All Superinterfaces:
Command
All Known Implementing Classes:
AbstractOverrideableCommand, AddCommand, CopyToClipboardCommand, CopyToClipboardOverrideCommand, CreateCopyCommand, InitializeCopyCommand, MoveCommand, PasteFromClipboardCommand, PasteFromClipboardOverrideCommand, RemoveCommand, ReplaceCommand, SetCommand, WrapperItemProvider.SimpleCopyCommand

public interface OverrideableCommand
extends Command

This represents a command that can be overridden by another command. The intended use of this is that an overrideable command should call EditingDomain.createOverrideCommand in its constructor to set up the override command. All its Command methods should then be guarded as follows:

   public void execute()
   {
     if (getOverride() != null)
     {
       getOverride().execute();
     }
     else
     {
       doExecute();
     }
   }
 
The contract with the overriding command is that the overrideable command will implement all its methods in corresponding doXxx methods, e.g., execute() is implemented in doExecute(), so that the overriding command can call back to the overrideable command's doXxx methods if it wants to extend rather than replace the original implementation. AbstractOverrideableCommand provides a convenient base implementation for overrideable commands.


Method Summary
 boolean doCanExecute()
          This is overrideable command's implementation of canExecute.
 boolean doCanUndo()
          This is overrideable command's implementation of canUndo.
 void doDispose()
          This is overrideable command's implementation of dispose.
 void doExecute()
          This is overrideable command's implementation of execute.
 java.util.Collection<?> doGetAffectedObjects()
          This is overrideable command's implementation of getAffectedObjects.
 java.lang.String doGetDescription()
          This is overrideable command's implementation of getDescription.
 java.lang.String doGetLabel()
          This is overrideable command's implementation of getLabel.
 java.util.Collection<?> doGetResult()
          This is overrideable command's implementation of getResult.
 void doRedo()
          This is overrideable command's implementation of redo.
 void doUndo()
          This is overrideable command's implementation of undo.
 Command getOverride()
          This returns the command that overrides this command.
 void setOverride(Command overrideCommand)
          This sets the command that overrides this command.
 
Methods inherited from interface org.eclipse.emf.common.command.Command
canExecute, canUndo, chain, dispose, execute, getAffectedObjects, getDescription, getLabel, getResult, redo, undo
 

Method Detail

getOverride

Command getOverride()
This returns the command that overrides this command.


setOverride

void setOverride(Command overrideCommand)
This sets the command that overrides this command.


doCanExecute

boolean doCanExecute()
This is overrideable command's implementation of canExecute.


doExecute

void doExecute()
This is overrideable command's implementation of execute.


doCanUndo

boolean doCanUndo()
This is overrideable command's implementation of canUndo.


doUndo

void doUndo()
This is overrideable command's implementation of undo.


doRedo

void doRedo()
This is overrideable command's implementation of redo.


doGetResult

java.util.Collection<?> doGetResult()
This is overrideable command's implementation of getResult.


doGetAffectedObjects

java.util.Collection<?> doGetAffectedObjects()
This is overrideable command's implementation of getAffectedObjects.


doGetLabel

java.lang.String doGetLabel()
This is overrideable command's implementation of getLabel.


doGetDescription

java.lang.String doGetDescription()
This is overrideable command's implementation of getDescription.


doDispose

void doDispose()
This is overrideable command's implementation of dispose.


Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.