This page is intended to explain how deletion works in the framework and our specific implementation for UCMs.
DeletionAction is added to our context menus / keybindings (See DevDocActions)
Our ComponentEditPolicies located in seg.jUCMNav.editpolicies.element all have a getDeleteCommand(GroupRequest request) method.
Given an editpart's component editpolicy, specify which command to run when delete is pressed/selected.
We need to be able to delete any PathNode from its path. See DeletePathNodeCommand
1 in / 1 out: is removed from the path
Multiple in or out: disconnect all branches
Might require deleting the element or downgrading it into an empty point. See DoesDisconnectImplyDelete
We need to be able to delete a Path, starting from its end point or start point. See DeletePathCommand and DevDocAlgoDeletion
Implicit deletion: When performing some transformations, such as merging a StartPoint and an EndPoint, elements are deleted and their properties must be removed.
Our original implementation used adhoc ways to get rid of certain information when deleting. We pretty much duplicated the code everywhere to, for example, remove InBindings/!OutBindings from
We did a good job implementing all this during explicit deletions, but we could not assure the uniformity with transformation commands.
When doing certain transformations, we not only need to delete the information, we sometimes need to move it. This is the case with NodeConnections around a Stub or after a Timer/!WaitingPlace/OrFork. If we insert a new node connection in between of the original one and the PathNode, we need to move plugin bindings, conditions, etc.
As a solution, we implemented a few CompoundCommands that are intended to be used everywhere an element must be deleted, so that we don't end up with model relationships that have not been broken.
The hardest part about deletion commands is that they can be run simultaneously in a large CompoundCommand built by the DeletionAction. One intuitively builds a GEF CompoundCommands by adding regular Commands during its constructor. However, we often cannot do this because the state of the model will change between the constructor and the execute() method. We therefore had to wait as long as possible before building our commands, by overriding canExecute() and execute().
What follows is a brief hierarchical overview of what is in both packages
PreDeleteUcmModelElementCommand : This command prepares an element for deletion.
CleanRelationshipsCommand : Removes all invisible relationships related to a NodeConnection, PathNode or ComponentRef.
RemoveLinkedInfoCommand : Given a ComponentRef, PathNode, NodeConnection or Map, remove its performance/scenario information
ComponentRefUnbindChildCommand (to disconnect from parent)