| Acceleo protected regions [message #1008671] |
Wed, 13 February 2013 09:20  |
Alexander Kuzmenko Messages: 3 Registered: February 2013 |
Junior Member |
|
|
Hi, I'm trying to use Acceleo tool to transform model to text. I need to have possibility to support incremental changes(user can modify some generated code freely).
I've made small test and found that all my changes overwritten by generated code each time.
[template public generatePackage(anEPackage : EPackage)]
[comment @main/]
[file('classifiers.txt', false)]
[comment [anEPackage.eClassifiers.name/]
[anEPackage.name /]
[anEPackage.eClassifiers.generateElement()/]
[/file]
[/template]
[template public generateElement( c : EClassifier)]
[if (c.oclIsKindOf(EClass))]
[c.oclAsType(EClass).genElement()/]
--[protected('Test')]
--TODO:should be implemented
--[/protected]
[/if]
[/template]
|
|
|
| Re: Acceleo protected regions [message #1009489 is a reply to message #1008671] |
Fri, 15 February 2013 03:24   |
Laurent Goubet Messages: 1548 Registered: July 2009 |
Senior Member |
|
|
Alexander,
Protected areas have to be unique within each file. What you are doing here means that you're generating one protected area for each classifier of your model, each with the same id ('Test'). Make sure to generate a distinct (but constant for every generation) identifier for your areas. For example :
Quote:
--[protected(c.name)]
--TODO:should be implemented
--[/protected]
Please also note that there should be nothing "after" the identifier, on the same line. Make sure you do not have extra whitespaces after the closing bracket (']') of the first line.
Laurent Goubet
Obeo
[Updated on: Fri, 15 February 2013 03:25] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01614 seconds