Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend]Allow user to add code in generated source
[Xtend]Allow user to add code in generated source [message #693961] Thu, 07 July 2011 14:46 Go to next message
Christophe  is currently offline Christophe Friend
Messages: 1
Registered: July 2011
Junior Member
Hello,
for a project I need to generate source from a DSL. With Xtext I made it well and follow the doc Xtext/documentation/2_0_0/040-first-code-generator.php. The problem is that I need to allow the user to write modifications in the generated source. I haven't see anything about this in Xtend documentation.

I have seen a little response openarchitectureware.org/pub/documentation/4.3.1/html/contents/recipe.html#recipe_ant_integration. It's a good solution but with this one I need to not generate myself the class file because it will be erase at each generation. Is there a way to read in my Xtend generator files of my project?
Or is there an other solution to enabling user doing modifications in files like with acceleo in which we can put javadoc comment to say "no don't erase my modifications there").

Thanks, Chris
Re: [Xtend]Allow user to add code in generated source [message #693970 is a reply to message #693961] Thu, 07 July 2011 14:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

for Questions on Xtend(2) please use the TMF Xtext forum.
Xtend2 does not support protected regions (see http://www.eclipse.org/forums/index.php/t/216713/). the generation gap pattern is preferred (you may support the user with a generateone stategy as xtext does this) or you have to come up with something yourself.

In General is the Configuability of Xtend2 regarding such things still very poor.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 07 July 2011 15:02]

Report message to a moderator

Re: [Xtend]Allow user to add code in generated source [message #909547 is a reply to message #693970] Fri, 07 September 2012 10:05 Go to previous messageGo to next message
Alex Lotz is currently offline Alex LotzFriend
Messages: 2
Registered: September 2012
Junior Member
Hello Christian,

I know your post is outdated. However, as far as I know it is still not really possible to use a generation gap pattern for custom code in Xtend2 (at least not for us, mortals). I do agree with you about protected regions. Do you maybe have some hints about the easiest way to use a generation gap pattern with Xtend2? I do like the new features of Xtend2, but without the possibility to separate custom code (generate once) from generated code, Xtend2 is just useless for me, at least I see no other option for this feature. Do you? I have talked with many MDE users and it seems I am not the only one having this question. So maybe your answer can be valuable for others.

Cheers,
Alex
Re: [Xtend]Allow user to add code in generated source [message #909560 is a reply to message #909547] Fri, 07 September 2012 10:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

Xtend 2.3.x allows different configurable outlets through IOutputConfigurationProvider
so it should be possible to do a generate once.
i guess the suport for configuring this is nice in eclipse EclipseOutputConfigurationProvider
but standalone (GeneratorComponent) it might still lack declarative configurability.

so give it a try

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend]Allow user to add code in generated source [message #910000 is a reply to message #909560] Sat, 08 September 2012 10:15 Go to previous message
Alex Lotz is currently offline Alex LotzFriend
Messages: 2
Registered: September 2012
Junior Member
Thank you Christian,

this was the hint I was searching for.

Together with the post on google groups:

[groups.google.com]/forum/#!topic/xtend-lang/jMI5iV6yO5Y
(sorry for this strange url syntax - the forum forbids me to send full urls)

I was able to implement a "generate once" behavior.

Cheers,
Alex

[Updated on: Sat, 08 September 2012 10:16]

Report message to a moderator

Previous Topic:[Acceleo] Create Standalone application
Next Topic:[Xtend/UML2] Resolving elements of a UML Profile.
Goto Forum:
  


Current Time: Fri Apr 26 13:09:40 GMT 2024

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

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

Back to the top