Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCore] Altering generated code
[XCore] Altering generated code [message #1002821] Sat, 19 January 2013 14:42 Go to next message
Martin  odloucký is currently offline Martin odloucký
Messages: 49
Registered: July 2010
Member
Hi you all,

I just started using XCore and I love it. But I don't understand one thing. Is ti still possible to alter the generated code? Sometimes I just need to add a static instance-counting field initialized in constructor to my generated class. However, when I try to edit the code as I have been used to with ECore, the IDE warns me that the file is derived. If I edit it anyway, when the code is regenerated all my changes are lost.

Thanks for help in advance

Martin
Re: [XCore] Altering generated code [message #1002889 is a reply to message #1002821] Sat, 19 January 2013 19:09 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26086
Registered: July 2009
Senior Member
Martin,

Comments below.


On 19/01/2013 3:42 PM, Martin odloucký wrote:
> Hi you all,
> I just started using XCore and I love it. But I don't understand one
> thing. Is ti still possible to alter the generated code?
Yes, but it's best if you plan to do that to specify (via annotations
you can set in the properties view) that code be generated in the src
folder so that a clean builder doesn't delete all the source.
> Sometimes I just need to add a static instance-counting field
> initialized in constructor to my generated class. However, when I try
> to edit the code as I have been used to with ECore, the IDE warns me
> that the file is derived. If I edit it anyway, when the code is
> regenerated all my changes are lost.
No, they should always be merged. Redirecting to something other than
the src-gen directory should avoid it being marked as derived (and it
being deleted by a clean build). Did you mark it @generated not?
> Thanks for help in advance
>
> Martin
Previous Topic:Annoying intrinsic default values for primitive types
Next Topic:[CDO][EMF Command] problems with SetCommand.redo from empty List
Goto Forum:
  


Current Time: Tue Sep 30 14:03:27 GMT 2014

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

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