Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Acceleo protected regions
Acceleo protected regions [message #1008671] Wed, 13 February 2013 14:20 Go to next message
Alexander Kuzmenko is currently offline 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 08:24 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
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 08:25]

Report message to a moderator

Re: Acceleo protected regions [message #1011302 is a reply to message #1009489] Tue, 19 February 2013 09:15 Go to previous message
Alexander Kuzmenko is currently offline Alexander Kuzmenko
Messages: 3
Registered: February 2013
Junior Member
Thanks. It works now.
Previous Topic:How can i run Workflow from java code
Next Topic:Generating Templates
Goto Forum:
  


Current Time: Thu Oct 30 13:12:27 GMT 2014

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

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