Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Quick question: Retrieving View eObject
Quick question: Retrieving View eObject [message #1731462] Thu, 05 May 2016 15:00 Go to next message
Eduardo Silva is currently offline Eduardo SilvaFriend
Messages: 12
Registered: September 2014
Junior Member
Hello there,

For element creation tools, specifically for edge creation, there is always two variables: sourceView and targetView that refers to the graphical element of, respectively, source and target. I am navigating through these elements, but I would like to, at some point, access the eObject it represents.

According to some forum topics and tutorials, there is a "target" field or method that retrieves this element, but as I try to use it, Sirius tells me there is no field (target) or method (target(), getTarget()). I believe I have to cast to a specific type (using oclAsType method) to be able to access it, but which type?

My expression, for now:
[sourceView.eContainer().eContainer().getTarget()/], whereas sourceView.eContainer().eContainer() is the diagram itself.

@Edit
For my specific case, I cannot navigate using source and target variables, since their eContainer() is an eObject that is part of another diagram.

[Updated on: Thu, 05 May 2016 15:13]

Report message to a moderator

Re: Quick question: Retrieving View eObject [message #1731788 is a reply to message #1731462] Tue, 10 May 2016 07:39 Go to previous messageGo to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
On 05/05/2016 05:00 PM, Eduardo Silva wrote:
> Hello there,

Hi,

>
> For element creation tools, specifically for edge creation, there is
> always two variables: sourceView and targetView that refers to the
> graphical element of, respectively, source and target. I am navigating
> through these elements, but I would like to, at some point, access the
> eObject that it represents.
>
> According to some forum topics and tutorials, there is a "target" field
> or method that retrieves this element, but as I try to use it, Sirius
> tells me there is no field (target) or method (target(), getTarget()). I
> believe I have to cast to a specific type (using oclAsType method) to be
> able to access it, but which type?
>
> My expression, for now:
> [sourceView.eContainer().eContainer().getTarget()/], whereas
> sourceView.eContainer().eContainer() is the diagram itself.

If you are sure about the expected type you can cast (with oclAsType)
the eContainer() result to DSemanticDecorator which is the interface for
all DDiagramElements with a semantic target.

Regards,

--
Florian - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Quick question: Retrieving View eObject [message #1731905 is a reply to message #1731788] Tue, 10 May 2016 18:25 Go to previous message
Eduardo Silva is currently offline Eduardo SilvaFriend
Messages: 12
Registered: September 2014
Junior Member
DSemanticDecorator worked fine. DNode also worked, in this case.

Thanks.

@Edit
Is there any way to retrieve the DDiagram for the current diagram from any context? Just like Like var:diagram, but in an edge creation tool, for instance.

[Updated on: Tue, 10 May 2016 19:26]

Report message to a moderator

Previous Topic:Extend Sirius tab-bar extension
Next Topic:Reconnect Edge Issue
Goto Forum:
  


Current Time: Fri Apr 19 20:30:30 GMT 2024

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

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

Back to the top