de.tu_berlin.cs.tfs.muvitorkit.commands
Class SetEObjectFeatureValueCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by de.tu_berlin.cs.tfs.muvitorkit.commands.SetEObjectFeatureValueCommand

public class SetEObjectFeatureValueCommand
extends Command

The SetEObjectFeatureValueCommand is used for generically changing an EObject's value that is determined by a featureID. The MuvitorKit's direct edit mechanism uses this class, but it may be freely used to avoid repeated copy/paste of simple commands.

Rating red

Constructor Summary
SetEObjectFeatureValueCommand(EObject editedElement, String newValue, int featureID)
          Create a SetEObjectFeatureValueCommand that changes the value of an EObject' feature.
 
Method Summary
 boolean canExecute()
          This command can be executed if a feature of the edited element corresponding to the featureID has been found.
 void execute()
           
 void redo()
           
 void undo()
           
 
Methods inherited from class org.eclipse.gef.commands.Command
canUndo, chain, dispose, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetEObjectFeatureValueCommand

public SetEObjectFeatureValueCommand(EObject editedElement,
                                     String newValue,
                                     int featureID)
Create a SetEObjectFeatureValueCommand that changes the value of an EObject' feature.

Parameters:
editedElement - the element whose feature value should be changed
newValue - the new value
featureID - the featureID of the feature to be changed, should be retrieved from the EMF model's @link EPackage.
Method Detail

canExecute

public boolean canExecute()
This command can be executed if a feature of the edited element corresponding to the featureID has been found.

Overrides:
canExecute in class Command

execute

public void execute()
Overrides:
execute in class Command

undo

public void undo()
Overrides:
undo in class Command

redo

public void redo()
Overrides:
redo in class Command