Skip to main content



      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
Eclipse UserFriend
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
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
Eclipse UserFriend
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
Eclipse UserFriend
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!

[Updated on: Tue, 02 November 2010 01:37] by 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
Eclipse UserFriend
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
Eclipse UserFriend
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.
Re: [Acceleo 3.1] protected block [message #636841 is a reply to message #636636] Wed, 03 November 2010 00:45 Go to previous message
Eclipse UserFriend
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.
Previous Topic:[Acceleo] Error log with not caption
Next Topic:[Acceleo 3] write all the imports of a class
Goto Forum:
  


Current Time: Wed Jul 23 14:31:51 EDT 2025

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

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

Back to the top