Papyrus diagram rootelement and owner [message #1781301] |
Mon, 05 February 2018 20:11  |
Eclipse User |
|
|
|
Hi Forum,
A Papyrus diagram has a "Owner" and a "Root element". The method someElement.getPapyrusDiagrams() seems to retrieve the diagrams for which someElement is the "Root element". Is there a method to get the diagrams for which someElement is the "Owner"?
Thanks in advance!
-Arun
(Newcomer to Papyrus & Gendoc.)
|
|
|
Re: Papyrus diagram rootelement and owner [message #1781305 is a reply to message #1781301] |
Mon, 05 February 2018 21:04   |
Eclipse User |
|
|
|
Hello Arun and welcome.
EDIT : Indeed getPapyrusDiagrams has a side effect. It loads the notation file with the same name of the uml containing your element and search for a notation::Diagram which has a feature element linked to your element (the root element).
If you want the owner of the diagram, you can open a bug to have it automatically in the papyrus bundle OR
- you can start your template from a notation file and do :
style::PapyrusViewStyle.allInstances()
from the papyrus view Style :
- eContainer().oclAsType(notation::Diagram) to get the diagram
- owner to check if it is the element you are looking for
- you can start from uml
self.eAllContents().getPapyrusDiagrams(), to trigger the side effects and load the notation files then
style::PapyrusViewStyle.allInstances()->select(owner = yourElement).eContainer().oclAsType(notation::Diagram) to get your diagram.
tell me if you have troubles
[Updated on: Tue, 06 February 2018 07:47] by Moderator Report message to a moderator
|
|
|
Re: Papyrus diagram rootelement and owner [message #1781340 is a reply to message #1781305] |
Tue, 06 February 2018 08:56   |
Eclipse User |
|
|
|
Hi,
Alternative (if you are using some of the Gendoc 0.7 milestones) you may define a query in a gendoc tag or a fragment as:
[query getOwnedPapyrusDiagrams(element : uml::Element) : Set(notation::Diagram) = notation::Diagram.allInstances()->select(d : notation::Diagram | d.styles->filter(style::PapyrusViewStyle).owner->first() = element)/]
and use it as a normal [ ... e->getOwnedPapyrusDiagrams() ...]
Be aware that you may need to use 'style::PapyrusDiagramStyle'instead of 'style::PapyrusViewStyle' if you are using latest versions of Oxygen.
In any case, If you open a bug in bugzilla, we can add that query to the Papyrus bundle, so the getOwnedPapyrusDiagrams(element : uml::Element) : Set(notation::Diagram) is provided by default.
Regards,
Antonio
|
|
|
|
Powered by
FUDForum. Page generated in 0.06554 seconds