Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » Keeping package hierarchy in the documentation
Keeping package hierarchy in the documentation [message #1766910] Wed, 28 June 2017 16:52 Go to next message
Eclipse UserFriend
Hello,
I'm able to sort the packages by name, with the following command:
[for(p:Package|self.ownedElement->filter(Package)->sortedBy(name))]

It seems that without the sortedBy, the packages are not ordered like in the project hierarchy, is there a way to do this (ie specifying an id attached to the package, or a specific diagram) ?

Samuel
Re: Keeping package hierarchy in the documentation [message #1766953 is a reply to message #1766910] Thu, 29 June 2017 06:03 Go to previous messageGo to next message
Eclipse UserFriend
Not sure what you mean by "project hierarchy" according to your code. To me "hierarchy" implies that you have more than one level of nesting, while your code only consider one. If you want to address more than one level you will need to nest loops.
Re: Keeping package hierarchy in the documentation [message #1766966 is a reply to message #1766953] Thu, 29 June 2017 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Hello Yves,
I'm ok with your definition of hierarchy: by considering multiple elements at the same level (ie: Root element with packages) as in the attached picture, I would like to keep the ordering as in the "project"...
  • Attachment: Packages.png
    (Size: 3.81KB, Downloaded 131 times)
Re: Keeping package hierarchy in the documentation [message #1766970 is a reply to message #1766966] Thu, 29 June 2017 08:01 Go to previous messageGo to next message
Eclipse UserFriend
Hello
I don't remember if a query exists in the standard gendoc API (but it should ;))
But you can try something like that :

[for(p:Package|self.ownedElement->filter(Package)->sortedBy( e | e.eContainer().eContents()->indexOf(e))/]

The sortedBy expression will use the value returned by index of to sort the elements

(Simpler) You can also do : [for(p:Package|self.eContents()->filter(Package))/]

[Updated on: Thu, 29 June 2017 08:02] by Moderator

Report message to a moderator

Re: Keeping package hierarchy in the documentation [message #1766980 is a reply to message #1766970] Thu, 29 June 2017 08:58 Go to previous message
Eclipse UserFriend
Hello Tristan,
I used the simpler solution and works fine.

Tx, Samuel
Previous Topic:detecting empty collection
Next Topic:Gendoc with Papyrus 3.0.0 (Oxygen)
Goto Forum:
  


Current Time: Mon Feb 10 08:10:49 GMT 2025

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

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

Back to the top