How can I execute the same module more that once but keep the previous generated code file?
A short explanation is that I have a main module that calles other modules. generate.mtl
[comment encoding = UTF-8 /]
[module generate('http:///AndroidUI.ecore')/]
[import pje13::androidui::codegeneration::xml_generate /]
[import pje13::androidui::codegeneration::java_generate /]
[import pje13::androidui::codegeneration::xml_strings /]
[template public generate(app : Application)]
[comment @main /]
[for (page : Page | app.page)]
[for (activity : Activity | app.activity)]
[if (activity.name.contains(page.name.replace('activity_', '').toUpperFirst()))]
**[genPage(page, app.name, activity)/]**
[/if]
[/for]
[/for]
[comment] match between an activity and an layout is:
MainActivity.java == activity_main.xml [/comment]
[/template]
[template public **genPage**(element:Page, appName:String, activity : Activity)]
[GenerateJava(element,appName,activity)/]
**[GenerateStrings(element)/]**
[GenerateXML(element,activity)/]
[/template]
If I have more than one page, the template [GenerateStrings(element)/]
will be called more than once. As the Console output says
!ENTRY org.eclipse.acceleo.engine 2 0 2013-12-24 13:20:09.000
!MESSAGE Some files were generated more than once during this generation.
/res/values/strings.xml : 3 times
So the file will contain only the last modification not all the code from file1 & file2.
When I was searching for a solution I only found Incremental generation using
<%startUserCode>
<%endtUserCode>
or
* @generate NOT
But this is not a solution for an XML file.
The code that I'm ussing to write the xml row is this:
[template public setStrings(button : Button)]
[if (button.text <> null)]<string name="strings_[button.text.toString()/]">[button.text.toString()/]</string>[else]<string name="const_default">button_text</string>[/if]
[/template]