Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » ETL: protected regions not working
ETL: protected regions not working [message #877041] Fri, 25 May 2012 19:10 Go to next message
Rui Carlos  Gonçalves is currently offline Rui Carlos GonçalvesFriend
Messages: 28
Registered: July 2009
Junior Member

I'm trying to use protected regions with ETL. So, I put the following code in the template:

[%=out.preserve("/*", "*/", name+"-Prop", true,"  //TODO")%]


This generates the following code:
  /* protected region Local-Prop on begin */
    //TODO
  /* protected region Local-Prop end */


which I think is correct.
Then I changed the previous code to this:
  /* protected region Local-Prop on begin */
    test();
  /* protected region Local-Prop end */


I was hopping that after generating the code again I was going to keep the 'test();', but that content is lost, and it is replaced with '//TODO'.

Am I doing anything wrong? Is there anything else I need to do, besides using the "preserve" method?
Re: ETL: protected regions not working [message #877108 is a reply to message #877041] Fri, 25 May 2012 22:18 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

That seems fine according to the book. In our case we use
[%=out.startPreserve("--", "--",entity.identifier + " Additional Descriptions", true)%]

[%=out.stopPreserve()%]


But I now recall I have a report of preserved regions being overwritten as in our case. Any one has any other ideas?


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: ETL: protected regions not working [message #877685 is a reply to message #877108] Sun, 27 May 2012 11:50 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
I am using a similar way (and it is working for me) to generate protected regions in a Makefile:
[%= out.startPreserve("##", "", "to add additional statements", true) %]
...
[%= out.stopPreserve() %]

Similar ways are used for C++ source and header files.

Before I got it working correctly, I was using special' characters, like slashes
That does not work in the current Epsilon (0.9.1) release, see bug #376968.
Re: ETL: protected regions not working [message #877775 is a reply to message #877685] Sun, 27 May 2012 17:55 Go to previous messageGo to next message
Rui Carlos  Gonçalves is currently offline Rui Carlos GonçalvesFriend
Messages: 28
Registered: July 2009
Junior Member

I've already tried many different ways (preserve/startPreserve, different ids, different comments ), and it's not working :\
I'm not using any special character in the id.
Re: ETL: protected regions not working [message #878479 is a reply to message #877775] Tue, 29 May 2012 12:01 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi Rui Carlos,

Rui Carlos Gonçalves wrote on Sun, 27 May 2012 13:55
I've already tried many different ways (preserve/startPreserve, different ids, different comments ), and it's not working :\
I'm not using any special character in the id.


I'm sorry to hear that you're having problems with protected regions. I think this might be related to the bug that Martin mentions. Can you try again without the hyphen in the identifier? So, for example:

[%=out.preserve("/*", "*/", name+"Prop", true,"  //TODO")%]


I believe that, in the latest stable release of Epsilon, identifiers could only contain word characters (i.e. [a-zA-Z_0-9]). Alternatively, you can try updating to the latest interim release of Epsilon, which contains the fix for this bug and should work with your existing code.

Hope this helps,
Louis.
Re: ETL: protected regions not working [message #878567 is a reply to message #878479] Tue, 29 May 2012 14:38 Go to previous messageGo to next message
Rui Carlos  Gonçalves is currently offline Rui Carlos GonçalvesFriend
Messages: 28
Registered: July 2009
Junior Member

Hi Louis. Thanks for your reply.

Louis Rose wrote on Tue, 29 May 2012 13:01
I believe that, in the latest stable release of Epsilon, identifiers could only contain word characters (i.e. [a-zA-Z_0-9]). Alternatively, you can try updating to the latest interim release of Epsilon, which contains the fix for this bug and should work with your existing code.


No, I have already tried that...

Is there any debug mode that can me help finding the problem?

BTW, do I have to set any option in the run configuration to be able to use protected regions?
Re: ETL: protected regions not working [message #879016 is a reply to message #878567] Wed, 30 May 2012 11:23 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi again,

There are no additional settings that need to be enabled: protected regions should work out of the box.

It sounds as though this might be a bug. Could you produce a minimal example that I can use to reproduce this behaviour? I'll then work on fixing the issue. There's some advice on producing useful minimal examples here:

http://www.eclipse.org/epsilon/doc/articles/minimal-examples/

Thanks,
Louis.
Re: ETL: protected regions not working [message #886913 is a reply to message #879016] Fri, 15 June 2012 20:33 Go to previous messageGo to next message
Rui Carlos  Gonçalves is currently offline Rui Carlos GonçalvesFriend
Messages: 28
Registered: July 2009
Junior Member

I think I've solved the problem...

I was calling the template directly in a Run Configuration and it was not working.
Now I'm using "TemplateFactory.load"/"generate" methods instead of calling the template directly, and it seems to be working Smile

Not sure if this is the expected behavior, but it solved the problem.

PS: Louis, if this is still a bug (i.e., if protected regions are supposed to work even without using the "TemplateFactory.load"/"generate"), let me know, and I'll create the bug report. (I haven't done it yet, as creating a minimal example, with metamodels and editor, takes some time :\ )

[Updated on: Fri, 15 June 2012 20:34]

Report message to a moderator

Re: ETL: protected regions not working [message #1776341 is a reply to message #886913] Wed, 15 November 2017 13:23 Go to previous messageGo to next message
Víctor López is currently offline Víctor LópezFriend
Messages: 22
Registered: June 2014
Junior Member
Hi all!,
is this issue solved?
I'm using latest interim version of Epsilon in Oxygen.

I use the sample code from the book:

// protected region anId on begin
System.out.println(foo);
// protected region anId end


If I use that code directly it doesn't work.
If I create a EGL file and called it with generate works on the new target specified in the generate method.
If I use process it doesn't work.

Are there any requirements for preserved regions to work?

Best,

Víctor

[Updated on: Wed, 15 November 2017 13:24]

Report message to a moderator

Re: ETL: protected regions not working [message #1776408 is a reply to message #1776341] Thu, 16 November 2017 08:56 Go to previous message
Víctor López is currently offline Víctor LópezFriend
Messages: 22
Registered: June 2014
Junior Member
Sorry, it's working. It was my fault.
I had forgotten adding [% out.setContentType("Java"); %]

Best,

Víctor

Víctor López wrote on Wed, 15 November 2017 14:23
Hi all!,
is this issue solved?
I'm using latest interim version of Epsilon in Oxygen.

I use the sample code from the book:

// protected region anId on begin
System.out.println(foo);
// protected region anId end


If I use that code directly it doesn't work.
If I create a EGL file and called it with generate works on the new target specified in the generate method.
If I use process it doesn't work.

Are there any requirements for preserved regions to work?

Best,

Víctor

Previous Topic:Connecting SQL Server 2012 to Java Eclipse
Next Topic: ETL Vs Manual development
Goto Forum:
  


Current Time: Thu Mar 28 14:41:08 GMT 2024

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

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

Back to the top