Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » Displaying packages in order
Displaying packages in order [message #1709877] Thu, 01 October 2015 16:34 Go to next message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Hi,

I would like to walk my model package by package, displaying contents at each level.
I use the following loop:
 [for (p:Package | self.ownedElement->filter(Package))]<drop/>
1	[p.name/]
 [p.displayClasses()/]<drop/>
[for (p2 :Package| p.ownedElement->filter(Package))]<drop/>
1.1		[p2.name/]
[p2.displayClasses()/]<drop/>
[for (p3 :Package| p2.ownedElement->filter(Package))] <drop/>
1.1.1	[p3.name/]
 [p3.displayClasses()/]<drop/>
 [for (p4 :Package| p3.ownedElement->filter(Package))] <drop/>
1.1.1.1	[p4.name/]
 [p4.displayClasses()/]<drop/>
	[/for]<drop/>
   [/for]<drop/>
 [/for]<drop/>
[/for]<drop/>


I get the packages correctly nested and the fragment displayClasses is returning the information I want, but the order is different at each generation.
Is there a way to get them always in the same order (preferably the one shown in the model)?

Side question: is nested loop the only way to walk the package hierarchy? no possibility of recursion?

Thanks and regards,

Marc
Re: Displaying packages in order [message #1709934 is a reply to message #1709877] Fri, 02 October 2015 06:50 Go to previous messageGo to next message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Hi,

I think I have found a way to display pacakges always in the same order. I am adding a sort after the filter:
[for (p:Package | self.ownedElement->filter(Package)->sortedBy(name))]<drop/>


This seems to work fine.

Best regards,

Marc
Re: Displaying packages in order [message #1709936 is a reply to message #1709934] Fri, 02 October 2015 07:15 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 426
Registered: July 2009
Senior Member
Nice to see you found a solution !
about recursivity you can achieve it using fragments but we have to improve that.




Re: Displaying packages in order [message #1709942 is a reply to message #1709936] Fri, 02 October 2015 07:35 Go to previous message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Hi Tristan,

Thanks.
One problem I found with fragments is with headers.

In the displayClasses fragment shown above, I would like to display each class with a header including the class name, but as the fragment is called at different levels, it might be sometimes a header 4, or header 5 or header 6.
a NextHeader tag would be nice Smile

Best regards,

Marc
Previous Topic:More on stereotypes
Next Topic:Error opening generated word document
Goto Forum:
  


Current Time: Thu Nov 15 12:10:07 GMT 2018

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

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

Back to the top