roneditor.commands
Class RenameNamedElementCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by roneditor.commands.RenameNamedElementCommand

public class RenameNamedElementCommand
extends org.eclipse.gef.commands.Command

Command to change the name of a NamedElement. This is undoable.

Author:
Tony Modica

Field Summary
private static java.lang.String EditCommand_Label
           
protected  ronmodel.NamedElement namedElement
           
protected  java.lang.String newName
           
protected  java.lang.String oldName
           
 
Constructor Summary
RenameNamedElementCommand(ronmodel.NamedElement namedElement)
           
 
Method Summary
 void execute()
          Executes the command by storing the old name of the named element and setting the new one.
 void redo()
           
 void setNewName(java.lang.String newName)
           
 void undo()
          Undoes the command by resetting the old name of the named element.
 
Methods inherited from class org.eclipse.gef.commands.Command
canExecute, 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
 

Field Detail

EditCommand_Label

private static final java.lang.String EditCommand_Label
See Also:
Constant Field Values

namedElement

protected ronmodel.NamedElement namedElement

oldName

protected java.lang.String oldName

newName

protected java.lang.String newName
Constructor Detail

RenameNamedElementCommand

public RenameNamedElementCommand(ronmodel.NamedElement namedElement)
Method Detail

execute

public void execute()
Executes the command by storing the old name of the named element and setting the new one.

Overrides:
execute in class org.eclipse.gef.commands.Command

undo

public void undo()
Undoes the command by resetting the old name of the named element. The old name has been saved by execute().

Overrides:
undo in class org.eclipse.gef.commands.Command

redo

public void redo()
Overrides:
redo in class org.eclipse.gef.commands.Command

setNewName

public void setNewName(java.lang.String newName)
Parameters:
newName - The newName to set.