|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.gef.commands.Command
pl.edu.agh.cast.backward.command.DeleteModelElementsCommand
public class DeleteModelElementsCommand
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.
Field Summary | |
---|---|
static Object |
ID
Id of the command. |
Constructor Summary | |
---|---|
DeleteModelElementsCommand(IDiagram diagram)
Creates new instance of command to delete model elements. |
Method Summary | |
---|---|
void |
add(Connection connection)
Adds Connection to remove. |
void |
add(ConnectionGroup group)
Adds ConnectionGroup to remove. |
void |
add(Node node)
Adds Node to remove. |
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 |
---|
public static final Object ID
Constructor Detail |
---|
public DeleteModelElementsCommand(IDiagram diagram)
diagram
- the diagram to operate onMethod Detail |
---|
public void add(Connection connection)
Connection
to remove.
connection
- connection to removepublic void add(ConnectionGroup group)
ConnectionGroup
to remove.
group
- connection group to removepublic void add(Node node)
Node
to remove.
node
- node to removepublic void execute()
execute
in class org.eclipse.gef.commands.Command
Command.execute()
public void undo()
undo
in class org.eclipse.gef.commands.Command
Command.undo()
public void redo()
redo
in class org.eclipse.gef.commands.Command
Command.redo()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |