Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » Papyrus diagram rootelement and owner(How to reference a Papyrus diagram from its owner)
Papyrus diagram rootelement and owner [message #1781301] Mon, 05 February 2018 20:11 Go to next message
Arun Gupta is currently offline Arun GuptaFriend
Messages: 3
Registered: January 2018
Junior Member
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 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 425
Registered: July 2009
Senior Member
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]

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 Go to previous messageGo to next message
Antonio Campesino is currently offline Antonio CampesinoFriend
Messages: 38
Registered: August 2016
Member
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

Re: Papyrus diagram rootelement and owner [message #1781577 is a reply to message #1781340] Thu, 08 February 2018 21:22 Go to previous message
Arun Gupta is currently offline Arun GuptaFriend
Messages: 3
Registered: January 2018
Junior Member
Thanks, and I will experiment and report back here!
Previous Topic:include external fragments
Next Topic:Matrix support in the future release Gendoc 0.7
Goto Forum:
  


Current Time: Fri Sep 21 05:35:14 GMT 2018

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

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

Back to the top