Home » Eclipse Projects » Sirius » Quick question: Retrieving View eObject
Quick question: Retrieving View eObject [message #1731462] |
Thu, 05 May 2016 15:00 |
Eduardo Silva 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 |
|
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
|
|
| |
Goto Forum:
Current Time: Fri Apr 19 20:30:30 GMT 2024
Powered by FUDForum. Page generated in 0.03341 seconds
|