Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Generate package with same order as the UML editor
[Acceleo] Generate package with same order as the UML editor [message #1710418] Tue, 06 October 2015 14:14 Go to next message
Johan Hardy is currently offline Johan HardyFriend
Messages: 47
Registered: December 2012
Member

Dear all,

I need help for a basic M2T transformation with UML. I would like to generate from the following UML model:

index.php/fa/23461/0/

A list of ordered package names in a simple text file with the following template:

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/5.0.0/UML')]

[template public generateElement(aModel : uml::Model)]
[comment @main/]
[file ('test.txt', false, 'UTF-8')]
[let seq : OrderedSet(uml::Package) = aModel->asOrderedSet()]
[for (p : Package | seq)]
[name/]
[/for]
[/let]
[/file]
[/template]


The expected list should be:
1
3
2
5
4


With Acceleo and from a generation to another I have a different results. Is there any suggestion to generate package with the expected order ?

Best regards;
  • Attachment: Untitled.png
    (Size: 5.78KB, Downloaded 287 times)

[Updated on: Tue, 06 October 2015 14:17]

Report message to a moderator

Re: [Acceleo] Generate package with same order as the UML editor [message #1710427 is a reply to message #1710418] Tue, 06 October 2015 15:04 Go to previous message
Johan Hardy is currently offline Johan HardyFriend
Messages: 47
Registered: December 2012
Member

I finally found the solution:

[query public sortByOrder(b : Sequence(uml::NamedElement)) : Sequence (uml::NamedElement) = 
b->sortedBy(n : uml::NamedElement | n.eContainer().eContents()->indexOf(n))/]
Previous Topic:[ACCELEO] call Query interpreter programmatically
Next Topic:[ACCELEO] Add model preprocessing before text generation
Goto Forum:
  


Current Time: Thu Jul 19 09:15:07 GMT 2018

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

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

Back to the top