[Acceleo] Howto process the output before it is saved to a file [message #666745] |
Fri, 22 April 2011 02:47  |
Eclipse User |
|
|
|
Hi,
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
Springsite/Elver.org
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: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
|
|
|
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 03:58  |
Eclipse User |
|
|
|
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: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
|
|
|
Powered by
FUDForum. Page generated in 0.03959 seconds