[XCore] Altering generated code [message #1002821] |
Sat, 19 January 2013 09:42  |
Eclipse User |
|
|
|
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 14:09  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.07041 seconds