Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Howto process the output before it is saved to a file
[Acceleo] Howto process the output before it is saved to a file [message #666745] Fri, 22 April 2011 06:47 Go to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5433
Registered: July 2009
Senior Member
For Texo I do some postprocessing of the generated output before the output is saved to a file:
- I do formatting and import resolving of the generated java file
- Use jmerge to support merging of generated content with manual content

Where I do this I need a handle to the file and it should be possible to change the generated output before saving it to
the file.

Is there a specific place in Acceleo where I can implement this (a listener?)? I call Acceleo from java, so not through
the IDE.


With Regards, Martin Taal

Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: -
Web: -
Re: [Acceleo] Howto process the output before it is saved to a file [message #666754 is a reply to message #666745] Fri, 22 April 2011 07:58 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 430
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Martin,

In order to manipulate the generated output before the moment we save it in a file, you have two solutions:

1- You can change the strategy used for the generation from a default strategy to a preview strategy. With the preview strategy we won't generate the file, we will just return a map containing the generated content of each file. You can then manipulate those String and then you can write them in a file. You can change the generation strategy from the generated Java launcher. Then, the method generate will return the map containing the result of the generation.

2- You can also create a custom strategy, have a look at org.eclipse.acceleo.engine.generation.strategy.IAcceleoGener ationStrategy and org.eclipse.acceleo.engine.generation.strategy.DefaultStrate gy for more information. Strategies are used to determined what should be done with the generated content.

Stephane Begaudeau, Obeo
Twitter: @sbegaudeau
Acceleo wiki:
Blogs: &

Previous Topic:[Acceleo] Generate a complex inheritance list
Next Topic:[Acceleo] generate the emtl files somewhere else, or how to tell Buckminster to generate them?
Goto Forum:

Current Time: Wed Oct 07 19:42:10 GMT 2015

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

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