org.eclipse.emf.mapping.command
Class AddOverrideCommand

java.lang.Object
  extended by org.eclipse.emf.common.command.AbstractCommand
      extended by org.eclipse.emf.mapping.command.AddOverrideCommand
All Implemented Interfaces:
Command

public class AddOverrideCommand
extends AbstractCommand

This command overrides the AddCommand to additionally map the added object(s) to corresponding inputs.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.command.AbstractCommand
AbstractCommand.NonDirtying
 
Field Summary
protected  AddCommand addCommand
          This keeps track of the AddCommand we're overriding
protected  Command mapCommand
          This keeps track of the create mapping command(s) used to implement this command.
protected  MappingDomain mappingDomain
          This keeps track of the mapping domain in which the command operates.
 
Fields inherited from class org.eclipse.emf.common.command.AbstractCommand
description, isExecutable, isPrepared, label
 
Constructor Summary
AddOverrideCommand(MappingDomain domain, AddCommand addCommand)
          This creates a command instance that adds and then maps the added object(s).
 
Method Summary
 void dispose()
          Called to indicate that the command will never be used again.
 void execute()
          Performs the command activity required for the effect.
 java.util.Collection<?> getAffectedObjects()
          Returns an empty list.
 java.util.Collection<?> getResult()
          Returns an empty list.
protected  void mapOutputObject(java.lang.Object outputObject, java.lang.Object originatingInput, CompoundCommand subcommands)
           
protected  boolean prepare()
          Called at most once in AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution.
 void redo()
          Performs the command activity required to redo the effect after undoing the effect.
 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
canExecute, canUndo, chain, getDescription, getLabel, setDescription, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mappingDomain

protected MappingDomain mappingDomain
This keeps track of the mapping domain in which the command operates.


addCommand

protected AddCommand addCommand
This keeps track of the AddCommand we're overriding


mapCommand

protected Command mapCommand
This keeps track of the create mapping command(s) used to implement this command.

Constructor Detail

AddOverrideCommand

public AddOverrideCommand(MappingDomain domain,
                          AddCommand addCommand)
This creates a command instance that adds and then maps the added object(s).

Method Detail

prepare

protected boolean prepare()
Description copied from class: AbstractCommand
Called at most once in AbstractCommand.canExecute() to give the command an opportunity to ready itself for execution. The returned value is stored in AbstractCommand.canExecute(). In other words, you can override this method to initialize and to yield a cached value for the all subsequent calls to canExecute.

Overrides:
prepare in class AbstractCommand
Returns:
whether the command is executable.

execute

public 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.


mapOutputObject

protected void mapOutputObject(java.lang.Object outputObject,
                               java.lang.Object originatingInput,
                               CompoundCommand subcommands)

undo

public void undo()
Description copied from class: AbstractCommand
Throws a runtime exception.

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

redo

public 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.


dispose

public 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

getResult

public 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.

getAffectedObjects

public 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.

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.