Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3.1] protected block(problem on no java file)
[Acceleo 3.1] protected block [message #636510] Mon, 01 November 2010 12:10 Go to next message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Hi,

I'm trying to generate code for xml files. Is there any restrictions of the type of comments respected on the protected 'zone'?

The problem is that every time, when I edit the code between the protected block on the generated xml file, this code is erased after a regeneration and a .xml.lost file is generated with the erased code.

<!--[protected ('protected')]-->
	
<!--[/protected]-->


You know that for comments in xml I have to use: " <!--" and "-->"

If I only use the protected tags:
[protected ('protected')]
[/protected]

then all is fine, but I need the tags for the comments: "<!--"...

Thanks you,
Sergio



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Re: [Acceleo 3.1] protected block [message #636578 is a reply to message #636510] Mon, 01 November 2010 22:01 Go to previous messageGo to next message
Yannick Duchene (Hibou57) is currently offline Yannick Duchene (Hibou57)
Messages: 50
Registered: September 2010
Location: Metz (France - Europe)
Member
Hi Sergio,

Do you have many of these in your transformation script ? The protected blocks should have each a unique identifier. If your have the same identifier for all (here, "protected"), then may be Acceleo is confused.

Try to add a unique identifier for each, and tell if that work better.

P.S. the *.lost file you get is not an error : Acceleo always save protected sections it is to overwrite. You will probably feel this help in the future.
Re: [Acceleo 3.1] protected block [message #636586 is a reply to message #636578] Tue, 02 November 2010 01:36 Go to previous messageGo to next message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Thank you for the answer.

Yes, really I can't believe what's happening here. I was working with acceleo a few years ago, and after made some test this summer with acceleo 3.0, we began a big new project with accelo 3.1. Now I only have 3 protected zones in a acceleo project, this is the code:

- zone 1:
  	Logger.debug(this, "[o.name/]", "inicio");
     	
        //[protected ('delegateService')] 
     	
     	//[/protected]
     	remoteService.setParameters([getParametertToCall(o) /]);

-> the code here is not respected, and no *.lost file is generated.

- zone 2:
<!--[protected ('generateContext')]-->
		
<!--[/protected]--> 

--> the code here is not respected, but a *.lost file is generated

- zone 3:
<!--[protected ('generateServicesXML')]-->
		
<!--[/protected]-->

--> the code here is not respected, but a *.lost file is generated

I'm sure that I'm doing a great mistake, but by the time I can't
see what's wrong.

thank you!



Sergio Sacristán
http://s2o-bcn.blogspot.com/

[Updated on: Tue, 02 November 2010 01:37]

Report message to a moderator

Re: [Acceleo 3.1] protected block [message #636636 is a reply to message #636586] Tue, 02 November 2010 06:08 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1609
Registered: July 2009
Senior Member
Hi Sergio,

You've run here against a limitation that was already present in Acceleo 2 : you cannot have anything on the "start of user code" line other than the actual identifier of your protected area, as we'll try and match this identifier when restoring lost code.

<!-- [protected ('protected')] -->

you'll have to set the "comment end" on the following line as in :

<!-- [protected ('protected')]
-->
<!-- [/protected] --> (this one is not an issue)

If you really need the "-->" to end your comment on the same line as the start of user code, it will have to be part of the area's identifier :

<!-- [protected ('protected' + ' -->')]

Or we won't be able to match the identifiers against one another.


However, the first of your three exemples in your last comment bugs me :

Quote:

//[protected ('delegateService')]

//[/protected]
[...]
the code here is not respected



This is the usual use case, and is tested and retested. Are your sure this is "not" respected ?

Laurent Goubet
Obeo
Re: [Acceleo 3.1] protected block [message #636839 is a reply to message #636636] Wed, 03 November 2010 00:34 Go to previous messageGo to next message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Smile

thank you Laurent!

Now I have ok the generation of the xml files and well... the other one was right also, it was only a "paranormal" moment of the night.



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Re: [Acceleo 3.1] protected block [message #636841 is a reply to message #636636] Wed, 03 November 2010 00:45 Go to previous message
Sergio  is currently offline Sergio
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Smile

thank you Laurent!

Now I have ok the generation of the xml files and well... the other one was right also, it was only a "paranormal" moment of the night.



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Previous Topic:[Acceleo] Error log with not caption
Next Topic:[Acceleo 3] write all the imports of a class
Goto Forum:
  


Current Time: Mon Apr 21 11:48:55 EDT 2014

Powered by FUDForum. Page generated in 0.13756 seconds