Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » Acceleo protected regions
Acceleo protected regions [message #1008671] Wed, 13 February 2013 09:20 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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] by Moderator

Re: Acceleo protected regions [message #1011302 is a reply to message #1009489] Tue, 19 February 2013 04:15 Go to previous message
Eclipse UserFriend
Thanks. It works now.
Previous Topic:How can i run Workflow from java code
Next Topic:Generating Templates
Goto Forum:
  


Current Time: Tue Jul 22 17:46:25 EDT 2025

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

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

Back to the top