Modelers

org.topcased.modeler.commands
Class RecordingChangeCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by org.topcased.modeler.commands.RecordingChangeCommand

public abstract class RecordingChangeCommand
extends org.eclipse.gef.commands.Command

This command is based on the EMF ChangeRecorder. You just have to implement the doExecute method to manage undo/redo.


Constructor Summary
RecordingChangeCommand(Resource resource)
          Constructor
RecordingChangeCommand(ResourceSet resourceSet)
          Constructor
 
Method Summary
 boolean canUndo()
          I can undo if I have recorded any changes previously.
 void dispose()
           
protected abstract  void doExecute()
          Method to implement : execute the modifications on the model.
 void execute()
          I run the runnable when I execute the first time.
 void redo()
          Redoes by applying changes recorded in the last undo.
 void undo()
          Undoes by applying recorded changes.
 
Methods inherited from class org.eclipse.gef.commands.Command
canExecute, chain, getDebugLabel, getLabel, setDebugLabel, setLabel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordingChangeCommand

public RecordingChangeCommand(Resource resource)
Constructor

Parameters:
resource - The Resource to listen

RecordingChangeCommand

public RecordingChangeCommand(ResourceSet resourceSet)
Constructor

Parameters:
resourceSet - The Resource to listen
Method Detail

execute

public void execute()
I run the runnable when I execute the first time.

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

doExecute

protected abstract void doExecute()
Method to implement : execute the modifications on the model.


canUndo

public boolean canUndo()
I can undo if I have recorded any changes previously.

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

undo

public void undo()
Undoes by applying recorded changes.

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

redo

public void redo()
Redoes by applying changes recorded in the last undo.

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

dispose

public void dispose()
Overrides:
dispose in class org.eclipse.gef.commands.Command
See Also:
Command.dispose()

Modelers

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.