pl.edu.agh.cast.command
Class DeleteModelElementsCommand

java.lang.Object
  extended by org.eclipse.gef.commands.Command
      extended by pl.edu.agh.cast.command.DeleteModelElementsCommand

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

This command will be created multiple times because of the way delete requests work on edit parts. The exact same command is returned for all requests - GEF fires a single request for each model element to delete, and they're all aggregated into a single command. It should execute only once, deleting all elements at once, and undo only once, restoring them at once as well. That's what the _executed and _undone flags are for. GEF calls execute for a command created for each model element to be deleted - that's why this command's execute() will be called multiple times, and we have to guard against that.

Author:
awos

Field Summary
static java.lang.Object ID
           
 
Constructor Summary
DeleteModelElementsCommand(IDiagram diagram)
           
 
Method Summary
 void add(Connection connection)
           
 void add(ConnectionGroup group)
           
 void add(Node node)
           
 void execute()
           
 void redo()
           
 void undo()
           
 
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

ID

public static final java.lang.Object ID
Constructor Detail

DeleteModelElementsCommand

public DeleteModelElementsCommand(IDiagram diagram)
Method Detail

add

public void add(Connection connection)

add

public void add(ConnectionGroup group)

add

public void add(Node node)

execute

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

undo

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

redo

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


Copyright © 2007-2008 AGH University of Science and Technology. All Rights Reserved.