Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Navigate in the opposite sense from semantic element to the view
Navigate in the opposite sense from semantic element to the view [message #1794433] Thu, 30 August 2018 14:43 Go to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
Usually, to navigate from a view to a semantic element, I use this expression

view.oclAsType(viewpoint::DSemanticDecorator).target.oclAsType(....)

However, how can navigate in the opposite sense, i.e., from the semantic element to the view?

And how can I navigate from a view to its container view?

I need these two expressions in order to do a conditional processing based on the semantic element of the container view.

I need to write the following expression

If self.eContainer().getContainerView().oclAsType(viewpoint::DSemanticDecorator).target.oclIsTypeOf(XYZ)
then 
         doA()
else
         doB()
endif

The missing element is the getContainerView().

Any idea how can I get this information?


Re: Navigate in the opposite sense from semantic element to the view [message #1794438 is a reply to message #1794433] Thu, 30 August 2018 15:12 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi

Could you precise in which expression you want yo use this navigation ?
IMO, view.eContainer() should be the way to find the wanted container view.

Regards


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Navigate in the opposite sense from semantic element to the view [message #1794439 is a reply to message #1794438] Thu, 30 August 2018 15:14 Go to previous messageGo to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
Thank you Maxime for your reply.
I use this navigation in the precondition expression of a container.
Re: Navigate in the opposite sense from semantic element to the view [message #1794442 is a reply to message #1794439] Thu, 30 August 2018 15:50 Go to previous messageGo to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
I need to access to the view of the eContainer() of the semantic element (self) in a precondition expression.
Re: Navigate in the opposite sense from semantic element to the view [message #1794443 is a reply to message #1794442] Thu, 30 August 2018 15:56 Go to previous messageGo to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
I obtained the following error: Unrecognized variable: (view)
view variable seems to be not accessible in a precondition expression.

Any alternative?
Re: Navigate in the opposite sense from semantic element to the view [message #1794477 is a reply to message #1794443] Fri, 31 August 2018 07:06 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 516
Registered: July 2009
Location: Nantes, France
Senior Member
Hi,

In the precondition of a ContainerMapping, you should have access to container and containerView variables.

Note that for performance reason, we would recommend to do this test directly in the semantic candidates expression of the mapping (for example, with a ->select(..) if you use AQL, see [1]). In the case of the evaluation of the semantic candidate expression : self will correspond to your container and you will have access to containerView if you need to check things on its view.

Please also note that you can see which variables are available with the auto completion. For exemple, type var: in a expression field (yellow) and then hit ctrl+space, and a completion popup will show you the variables. (With aql: they should be at the bottom of the proposals list)


Regards,


[1] https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html


Maxime Porhel - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Navigate in the opposite sense from semantic element to the view [message #1794586 is a reply to message #1794477] Mon, 03 September 2018 11:20 Go to previous message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
Thank you, Maxime for your reply.
My issue is finally resolved.
To summarize, my issue is how to access to container view of the eContainer of a semantic element (self).
I used the diagram variable and I wrote the following condition and it works perfectly
not (diagram.containers->exists(con:DDiagramElementContainer|con.semanticElements->first().oclIsTypeOf(platform::Application) and con.containers>exists(contai:DDiagramElementContainer|contai.semanticElements->first()=self.eContainer())))
Previous Topic:Limit Edge endpoints to one side of a node
Next Topic:create Icon on Node
Goto Forum:
  


Current Time: Tue Apr 16 23:15:23 GMT 2024

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

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

Back to the top