|
||||||||||
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.schema.editor.command.DeleteElementsCommand
public class DeleteElementsCommand
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 | |
---|---|
DeleteElementsCommand(SchemaEditPart schemaEditPart)
Creates new instance of command to delete model elements. |
Method Summary | |
---|---|
void |
add(ISchemaConnection connection)
Adds ISchemaConnection to remove. |
void |
add(ISchemaElement element)
Adds ISchemaNode or ISchemaConnection to remove. |
void |
add(ISchemaNode node)
Adds ISchemaNode to remove along with all its connections. |
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 DeleteElementsCommand(SchemaEditPart schemaEditPart)
schemaEditPart
- schema edit part which controls diagram diagram to operate onMethod Detail |
---|
public void add(ISchemaConnection connection)
ISchemaConnection
to remove.
connection
- connection to removepublic void add(ISchemaNode node)
ISchemaNode
to remove along with all its connections.
node
- node to removepublic void add(ISchemaElement element)
ISchemaNode
or ISchemaConnection
to remove.
element
- element 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 |