Accessing elements from different EMF (libraries) [message #1831861] |
Tue, 01 September 2020 09:39 |
Antonin Messioux Messages: 5 Registered: June 2020 |
Junior Member |
|
|
Greetings,
I have developed a viewpoint that, on a click event on any Capella component (the_component), triggers an OpenAction(the_component) that is able to navigate in the EMF of the project thanks to the_component parameter, and sort all those elements into lists that I can use later on.
However, I am working with a Capella project that is referencing one library. Of course, those elements contained in the library are not parsed by my viewpoint as they belong to another EMF. After a week of struggling, my question is : how can I retrieve at least one component from the library so that I can parse it fully as the main project ?
Note that if I run the OpenAction by clicking on an element on a diagram that belongs to the library, the viewpoint is parsing correctly the EMF of the library, but not the EMF of the project.
I have tried to access the libraries from their graphical elements using https://wiki.eclipse.org/Capella/Tutorials/Extensibility/Edit.
Using the given code, I have been able to access all graphical elements in a diagram. Nonetheless, I have not found how to access a component from its representation, I guess its DDiagramElement. This solution would be the best for me as I would like to sort the elements later, according to the diagram they are displayed on.
I hope my problem is clear, thanks in advance for your help,
Have a great day,
Antonin
|
|
|
|
|
Re: Accessing elements from different EMF (libraries) [message #1832136 is a reply to message #1832134] |
Wed, 09 September 2020 21:43 |
Philippe Dul Messages: 25 Registered: November 2013 |
Junior Member |
|
|
For diagrams elements,
a diagram is composed by diagram elements, (diagram.getDiagramElements) which are referencing "semantic elements" such as the component.
for (DDiagramElement e: diagram.getDiagramElements()) {
if (e instanceof DSemanticDecorator) {
if (((DSemanticDecorator)e.getTarget()) instanceof Component) {
//xxxx
}
}
}
DDiagramElement sub types can be DNode (not decomposable, ex port, function in architecture blank), DEdge, DNodeContainer (decomposable, ex components in Architecture Blank) or DNodeList (like classes in class diagram blank)
[Updated on: Wed, 09 September 2020 21:45] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03807 seconds