Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Delete Edge Tool with bi-directional reference
Delete Edge Tool with bi-directional reference [message #1841600] Fri, 21 May 2021 13:42 Go to next message
Marco Codazzi is currently offline Marco CodazziFriend
Messages: 13
Registered: May 2021
Junior Member
I have in my modeling workbench:
- processing blocks that are represented by Containers
- ports of these blocks that are represented by Border Nodes
Ports can be input ports or output ports: input ports can be connected to a single output port whereas output ports can be connected to one ore more input ports. The relation between ports is a Bi-directional Reference:

OutputPort <--------------------------> InputPort 
            [0..1] out       [0..*] in


Following the advanced tutorial of BasicFamily I created the Edge Creation Tool:
- in context var:source (the output port) I set the feature "in" as var:target
- in context var:target (the input port) I set set the feature "out" as var:source
This Edge creation Tool works and it set the features correctly.

Now I have to create the Delete Edge Tool and I have some difficulties to understand how to proceed. The edge is a relation, and the advanced tutorial of BasicFamily says that the var:element is the source of the relation, i.e. my output port.
- in the output port I have a list "in" and I have to remove from this list the input port defined from target of this relation
- than I have to switch the context to the target of relation (the input port) and unset the feature "out".
I didn't undertand how to do these two things: remove one element from a list and switch the context to the target .

Re: Delete Edge Tool with bi-directional reference [message #1841679 is a reply to message #1841600] Tue, 25 May 2021 15:07 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 572
Registered: May 2011
Senior Member
Hello,

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".

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Delete Edge Tool with bi-directional reference [message #1841827 is a reply to message #1841600] Mon, 31 May 2021 12:25 Go to previous message
Marco Codazzi is currently offline Marco CodazziFriend
Messages: 13
Registered: May 2021
Junior Member
Thank you, I did what you suggested me and it worked.

You're right also about the second step of the creation tool: I removed it and the fields are correctly set anyway.



Previous Topic:SiriusCon Live 2021: the program is available
Next Topic:How to set table cell values programmatically?
Goto Forum:
  


Current Time: Sat Apr 27 01:44:39 GMT 2024

Powered by FUDForum. Page generated in 0.03326 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top