Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Change context to the root of the diagram in edge creation tool
Change context to the root of the diagram in edge creation tool [message #1806212] Mon, 06 May 2019 09:25 Go to next message
Adriano Carvalho is currently offline Adriano CarvalhoFriend
Messages: 54
Registered: November 2018
Member
Hi,

I have a model that looks like the following:

root
» typeA instanceA;
» typeA instanceA2;
» typeB instanceB;
» ...
» typeN instanceN;
» connections
»» instanceA connects to isntanceB
»» instance B connects to instanceN
»» ...


I have a "node" diagram element as well as a "element based edge" diagram element to show the instances and the connections between them. This works fine.

I want to have a "edge creation" tool and so I thought that I would "only" need to add the following under "Begin":

» Change context to "root.connections"
(instead of the above I thought it would also be possible to » Change context to "source.eContainer().connections".)
» Create instance "connection"
» Set attributes.


Nevertheless, I am having trouble right from the start (with change context).

1. I don't know how nor was able to find out how to navigate to the root of the diagram even though it seems like a plausible intent. Is this possible? How?

2. If I "navigate" the "source" I jump around some internal elements and not the actual model. Can I use "source" (or "target" BTW) to navigate the actual model? How?

Thanks is advance.

Best regards.
Adriano Carvalho

[Updated on: Mon, 06 May 2019 09:27]

Report message to a moderator

Re: Change context to the root of the diagram in edge creation tool [message #1806266 is a reply to message #1806212] Tue, 07 May 2019 08:37 Go to previous messageGo to next message
Adriano Carvalho is currently offline Adriano CarvalhoFriend
Messages: 54
Registered: November 2018
Member
Anyone?
Re: Change context to the root of the diagram in edge creation tool [message #1806451 is a reply to message #1806212] Thu, 09 May 2019 09:27 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 702
Registered: July 2009
Senior Member
Adriano Carvalho wrote on Mon, 06 May 2019 11:25

1. I don't know how nor was able to find out how to navigate to the root of the diagram even though it seems like a plausible intent. Is this possible? How?


You should probably have access to a variable named "diagram", which points to Sirius's DDiagram model element that represents the whole diagram. From there, the "target" reference will point to the semantic element (from your model) on which the diagram is created. In other words, "aql:diagram.target" should return your "root" model element.

Quote:

2. If I "navigate" the "source" I jump around some internal elements and not the actual model. Can I use "source" (or "target" BTW) to navigate the actual model? How?


As for DDiagram, the other internal Sirius model elements (DNode, DEdge, etc.) have a "target" reference that points to the semantic model element (in *your* model) they represent.

Regards,
Pierre-Charles


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Change context to the root of the diagram in edge creation tool [message #1806861 is a reply to message #1806451] Thu, 16 May 2019 14:14 Go to previous message
Adriano Carvalho is currently offline Adriano CarvalhoFriend
Messages: 54
Registered: November 2018
Member
Thank you Pierre-Charles.

I was finally able to solve my problem.

What we needed was to change

» Change context to "source.eContainer().connections"

to

» Change context to "source.eContainer().connections->last()"

This is necessary because in our model there can be more than one "connections" elements, like the following:

root
» typeA instanceA;
» typeA instanceA2;
» typeB instanceB;
» ...
» typeN instanceN;
» connections
»» instanceA connects to isntanceB
»» ...
» connections
»» instance B connects to instanceN
»» ...


Therefore, "connections" is actually a collection and not single element/context. In our case, we chose to rely on the last element.

BTW In "change context" the "diagram" variable doesn't seem to be accessible.
Previous Topic:Is there any limit that session will hold only less mb of data
Next Topic:Show Content Assist in properties view text widget
Goto Forum:
  


Current Time: Tue Apr 16 15:39:25 GMT 2024

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

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

Back to the top