|Re: Delete Edge Tool with bi-directional reference [message #1841679 is a reply to message #1841600]
||Tue, 25 May 2021 15:07
|| Steve Monnier
Registered: May 2011
As you have a bidirectional reference, in your creation tool or deletion tool, you only need to edit one of the references, EMF will update the opposite one as well. In your creation tool, you do not need the second step. I guess here it has no impact because you can't have the same reference multiple time.
Concerning the deletion tool, indeed var:element will reference the semantic element of your source (here an output port) as your mapping is representing an EReference and not an EObject. This also means that in this context, to find the "input port" (reference target) to remove from the "output port", you will need to user the variable "elementView" that reference to the graphical element of this reference on the diagram. From the reference, you can access its target node and from that node access the semantic element (input port). From the top of my head, the expression should be "elementView.targetNode.target". Note that you may need to add some casting (at least for the auto-completion) so that would be "elementView.targetNode.oclAsType(viewpoint::DSemanticDecorator).target".
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
Powered by FUDForum
. Page generated in 0.01548 seconds