## org.eclipse.emf.edit.command
Class AbstractOverrideableCommand

    java.lang.Object
      org.eclipse.emf.common.command.AbstractCommand
          org.eclipse.emf.edit.command.AbstractOverrideableCommand

All Implemented Interfaces:
  Command, OverrideableCommand

Direct Known Subclasses:
  AddCommand, CopyToClipboardCommand, CreateCopyCommand, InitializeCopyCommand, MoveCommand, PasteFromClipboardCommand, RemoveCommand, ReplaceCommand, SetCommand, WrapperItemProvider.SimpleCopyCommand

    public abstract class AbstractOverrideableCommand

extends AbstractCommand
implements OverrideableCommand

This is a convenient base class for classes that implement `OverrideableCommand`. Subclasses of AbstractOverrideableCommand should provide implementations of the doXxx methods (e.g., doExecute) from OverrideableCommand instead of the base command methods (e.g., execute), which have final implementations here.

Nested Class Summary

Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
`AbstractCommand.NonDirtying`

Field Summary
`protected EditingDomain` `domain` This is the editing doman in which this command operates.
`protected Command` `overrideCommand` This is the command that overrides this command.

Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
`description, isExecutable, isPrepared, label`

Constructor Summary
`protected` `AbstractOverrideableCommand(EditingDomain domain)` This constructs an instance in this editing domain.
`protected` `AbstractOverrideableCommand(EditingDomain domain, java.lang.String label)` This constructs an instance with the given label and in this editing domain.
`protected` `AbstractOverrideableCommand(EditingDomain domain, java.lang.String label, java.lang.String description)` This constructs an instance with the given label and description, in this editing domain.

Method Summary
`boolean` `canExecute()` Calls `AbstractCommand.prepare()`, caches the result in `AbstractCommand.isExecutable`, and sets `AbstractCommand.isPrepared` to `true`; from then on, it will yield the value of isExecutable.
`boolean` `canUndo()` Returns `true` because most command should be undoable.
`void` `dispose()` Called to indicate that the command will never be used again.
`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.
`abstract void` `doExecute()` This is overrideable command's implementation of execute.
`java.util.Collection<?>` `doGetAffectedObjects()` This is overrideable command's implementation of getAffectedObjects.
`java.util.Collection<?>` `doGetChildrenToCopy()`
`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.
`abstract void` `doRedo()` This is overrideable command's implementation of redo.
`abstract void` `doUndo()` This is overrideable command's implementation of undo.
`void` `execute()` Performs the command activity required for the effect.
`java.util.Collection<?>` `getAffectedObjects()` Returns an empty list.
`java.util.Collection<?>` `getChildrenToCopy()`
`java.lang.String` `getDescription()` Returns a string suitable to help describe the effect of this command.
`EditingDomain` `getDomain()` This returns the editing domain that contains this.
`java.lang.String` `getLabel()` Returns a string suitable to represent the label that identifies this command.
`Command` `getOverride()` This returns the command that overrides this command.
`static EList<java.lang.Object>` `getOwnerList(EObject owner, EStructuralFeature feature)`
`java.util.Collection<?>` `getResult()` Returns an empty list.
`void` `redo()` Performs the command activity required to `redo` the effect after undoing the effect.
`void` `setOverride(Command overrideCommand)` This sets the command that overrides this command.
`java.lang.String` `toString()` This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of `field:value` pairs.
`void` `undo()` Throws a runtime exception.

Methods inherited from class org.eclipse.emf.common.command.AbstractCommand
`chain, prepare, setDescription, setLabel`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.eclipse.emf.common.command.Command
`chain`

Field Detail

### domain

    protected EditingDomain domain

  This is the editing doman in which this command operates.

### overrideCommand

    protected Command overrideCommand

  This is the command that overrides this command.

Constructor Detail

### AbstractOverrideableCommand

    protected AbstractOverrideableCommand(EditingDomain domain)

  This constructs an instance in this editing domain.

### AbstractOverrideableCommand

    protected AbstractOverrideableCommand(EditingDomain domain,
                                          java.lang.String label)

  This constructs an instance with the given label and in this editing domain.

### AbstractOverrideableCommand

    protected AbstractOverrideableCommand(EditingDomain domain,
                                          java.lang.String label,
                                          java.lang.String description)

  This constructs an instance with the given label and description, in this editing domain.

Method Detail

### getDomain

    public EditingDomain getDomain()

  This returns the editing domain that contains this.

### getOverride

    public Command getOverride()

  This returns the command that overrides this command.

  Specified by:
    `getOverride` in interface `OverrideableCommand`

### setOverride

    public void setOverride(Command overrideCommand)

  This sets the command that overrides this command.

  Specified by:
    `setOverride` in interface `OverrideableCommand`

### canExecute

    public final boolean canExecute()

  Description copied from class: `AbstractCommand`
  Calls `AbstractCommand.prepare()`, caches the result in `AbstractCommand.isExecutable`, and sets `AbstractCommand.isPrepared` to `true`; from then on, it will yield the value of isExecutable.

  Specified by:
    `canExecute` in interface `Command`
  Overrides:
    `canExecute` in class `AbstractCommand`
  Returns:
    whether the command can execute.

### doCanExecute

    public boolean doCanExecute()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of canExecute.

  Specified by:
    `doCanExecute` in interface `OverrideableCommand`

### execute

    public final void execute()

  Description copied from interface: `Command`
  Performs the command activity required for the effect. The effect of calling `execute` when `canExecute` returns `false`, or when `canExecute` hasn't been called, is undefined.

  Specified by:
    `execute` in interface `Command`

### doExecute

    public abstract void doExecute()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of execute.

  Specified by:
    `doExecute` in interface `OverrideableCommand`

### canUndo

    public final boolean canUndo()

  Description copied from class: `AbstractCommand`
  Returns `true` because most command should be undoable.

  Specified by:
    `canUndo` in interface `Command`
  Overrides:
    `canUndo` in class `AbstractCommand`
  Returns:
    `true`.

### doCanUndo

    public boolean doCanUndo()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of canUndo.

  Specified by:
    `doCanUndo` in interface `OverrideableCommand`

### undo

    public final void undo()

  Description copied from class: `AbstractCommand`
  Throws a runtime exception.

  Specified by:
    `undo` in interface `Command`
  Overrides:
    `undo` in class `AbstractCommand`

### doUndo

    public abstract void doUndo()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of undo.

  Specified by:
    `doUndo` in interface `OverrideableCommand`

### redo

    public final void redo()

  Description copied from interface: `Command`
  Performs the command activity required to `redo` the effect after undoing the effect. The effect, if any, of calling `redo` before `undo` is called is undefined. Note that if you implement `redo` to call `execute` then any derived class will be restricted by that decision also.

  Specified by:
    `redo` in interface `Command`

### doRedo

    public abstract void doRedo()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of redo.

  Specified by:
    `doRedo` in interface `OverrideableCommand`

### getResult

    public final java.util.Collection<?> getResult()

  Description copied from class: `AbstractCommand`
  Returns an empty list.

  Specified by:
    `getResult` in interface `Command`
  Overrides:
    `getResult` in class `AbstractCommand`
  Returns:
    an empty list.

### doGetResult

    public java.util.Collection<?> doGetResult()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getResult.

  Specified by:
    `doGetResult` in interface `OverrideableCommand`

### getAffectedObjects

    public final java.util.Collection<?> getAffectedObjects()

  Description copied from class: `AbstractCommand`
  Returns an empty list.

  Specified by:
    `getAffectedObjects` in interface `Command`
  Overrides:
    `getAffectedObjects` in class `AbstractCommand`
  Returns:
    an empty list.

### doGetAffectedObjects

    public java.util.Collection<?> doGetAffectedObjects()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getAffectedObjects.

  Specified by:
    `doGetAffectedObjects` in interface `OverrideableCommand`

### getLabel

    public final java.lang.String getLabel()

  Description copied from interface: `Command`
  Returns a string suitable to represent the label that identifies this command.

  Specified by:
    `getLabel` in interface `Command`
  Overrides:
    `getLabel` in class `AbstractCommand`
  Returns:
    a string suitable to represent the label that identifies this command.

### doGetLabel

    public java.lang.String doGetLabel()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getLabel.

  Specified by:
    `doGetLabel` in interface `OverrideableCommand`

### getDescription

    public final java.lang.String getDescription()

  Description copied from interface: `Command`
  Returns a string suitable to help describe the effect of this command.

  Specified by:
    `getDescription` in interface `Command`
  Overrides:
    `getDescription` in class `AbstractCommand`
  Returns:
    a string suitable to help describe the effect of this command.

### doGetDescription

    public java.lang.String doGetDescription()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of getDescription.

  Specified by:
    `doGetDescription` in interface `OverrideableCommand`

### dispose

    public final void dispose()

  Description copied from interface: `Command`
  Called to indicate that the command will never be used again. Calling any other method after this one has undefined results.

  Specified by:
    `dispose` in interface `Command`
  Overrides:
    `dispose` in class `AbstractCommand`

### doDispose

    public void doDispose()

  Description copied from interface: `OverrideableCommand`
  This is overrideable command's implementation of dispose.

  Specified by:
    `doDispose` in interface `OverrideableCommand`

### getChildrenToCopy

    public final java.util.Collection<?> getChildrenToCopy()

### doGetChildrenToCopy

    public java.util.Collection<?> doGetChildrenToCopy()

### getOwnerList

    public static EList<java.lang.Object> getOwnerList(EObject owner,
                                                       EStructuralFeature feature)

### toString

    public java.lang.String toString()

  This gives an abbreviated name using this object's own class' name, without package qualification, followed by a space separated list of `field:value` pairs.

  Overrides:
    `toString` in class `AbstractCommand`
  Returns:
    string representation.

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