Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] How to determine why a template isn't called
[Acceleo] How to determine why a template isn't called [message #554742] Tue, 24 August 2010 09:48 Go to next message
Eclipse UserFriend
Originally posted by: templth.yahoo.fr

Hello,

I developed a template that seems correct but nothing happens when
launching generation (from Acceleo Application in Run Configurations).
It seems that my parameter of my template doesn't match to any element
in the model... At least one should match... Is there a way to see
traces from the Acceleo engine or simulate execution?

Note that I use a metamodel with several packages and I declare several
packages in the generate attribute of the module...

Thanks very much for your help!
Thierry
Re: [Acceleo] How to determine why a template isn't called [message #554756 is a reply to message #554742] Tue, 24 August 2010 10:58 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can use the debugger with some breakpoints and the debug perspective in order to see the execution of your generation. With the debugger you can see the value of your variable and see the execution path line by line: Click me !!

Stéphane Bégaudeau, Obeo

[Updated on: Tue, 24 August 2010 14:14]

Report message to a moderator

Re: [Acceleo] How to determine why a template isn't called [message #554871 is a reply to message #554756] Tue, 24 August 2010 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: templth.yahoo.fr

Hello Stéphane,

Yes, I agree with you but the problem here is that processing never goes
in template so specifying breakpoints within templates is useless...

Thierry

> Hi,
>
> You can use the debugger with some breakpoint and the debug perspective
> in order to see the execution of you generation. With the debugger you
> can see the value of your variable and see the execution path line by
> line: http://a.imageshack.us/img339/2161/debuge.png
>
> Stéphane Bégaudeau, Obeo
Re: [Acceleo] How to determine why a template isn't called [message #554883 is a reply to message #554742] Tue, 24 August 2010 15:38 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

If your template was not the starting point of your generation, you could see why the parameters are not matching, I didn't thought of your template as the starting point of your generation, sorry.

1- Does it sill has its main comment : [comment @main/] ? (even if I'm pretty sure that an error would appear if you tried to launch a generation without it)
2- Do you have modified the generated java class ? (if yes, you can delete it and save your acceleo module again, the java class will be generated and then try again)
3- Do you have the same problem with a very simple template and model, if yes can you show me the template, the model and your launch configuration ? Because I tried to recreate the problem and for me it works. It would be very helpful in order to track the problem.


Stephane Begaudeau, Obeo
Re: [Acceleo] How to determine why a template isn't called [message #555145 is a reply to message #554883] Wed, 25 August 2010 15:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: templth.yahoo.fr

Hello Stéphane,

No problem! Your hints help me a lot!

It seems that the manual registering of my metamodel within my current
Eclipse instance isn't enough... As a matter of fact, when trying to
create the acceleo project, my uri doesn't appear in the list of
"Metamodel URI"... Moreover, if I run a new Eclipse instance and create
in it an acceleo project with my template, everything works fine and the
code is generated.

For information, I register the metamodel like this:

public static void main(String[] args) {
EPackage architecturePackage = ArchitecturePackage.eINSTANCE;
EPackage.Registry.INSTANCE.put(architecturePackage.getNsURI( ),
architecturePackage);

Any idea?

Thierry

> Hi,
>
> If your template was not the starting point of your generation, you
> could see why the parameters are not matching, I didn't thought of your
> template as the starting point of your generation, sorry.
>
> 1- Does it sill has its main comment : [comment @main/] ? (even if I'm
> pretty sure that an error would appear if you tried to launch a
> generation without it)
> 2- Do you have modified the generated java class ? (if yes, you can
> delete it and save your acceleo module again, the java class will be
> generated and then try again)
> 3- Do you have the same problem with a very simple template and model,
> if yes can you show me the template, the model and your launch
> configuration ? Because I tried to recreate the problem and for me it
> works. It would be very helpful in order to track the problem.
>
>
> Stephane Begaudeau, Obeo
Re: [Acceleo] How to determine why a template isn't called [message #555277 is a reply to message #555145] Thu, 26 August 2010 07:46 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

Well if it is working with another instance of Eclipse but not with the current instance, the problem is definitely coming from the registration process. That's a common problem when working with EMF. To solve this problem, I think that you have 5 solutions:

1- you can work with another Eclipse instance (yes I know, it's painful...)

2- you can try to load your model by creating a new EMF project [not an empty one] because the new EMF project wizard has an option to load your metamodel. It worked for me a few time.

3- you can use the relative path to your model instead of its URI (I've learned that trick this morning from the original creator of Acceleo), I've tested it and it worked. Here is a screenshot of how to do it: Click me !. The key here is the [module generate('platform:/resource/org.eclipse.acceleo.test/model/ MetaTest.ecore')/] instead of [module generate('http://myURI.com')/]

4- you can use the normal URI of your metamodel with your metamodel in another project or anywhere else if the project that contains your metamodel is a dependency of your Acceleo project and if that metamodel is registered thanks to EMF extention point (org.eclipse.emf.ecore.dynamic_package). I've tested it and it also worked (I've also learned that trick this morning Smile). Here are two screenshots to see how it's done : n°1 and n°2

5- you can try to register your metamodel by yourself with a bit of Java, like it is described here.

So with this solution, I have created another project with my meta model, registered thanks to the EMF extension point and this new project is a dependency of my Acceleo project (screenshot 1). And then I can use it in my Acceleo project and it works as you can see it in the screenshot 2.


Well, I think you have here all the available solutions (and I've learned two great solutions while searching this for you Very Happy)


Stephane Begaudeau, Obeo

[Updated on: Thu, 26 August 2010 07:48]

Report message to a moderator

Re: [Acceleo] How to determine why a template isn't called [message #556672 is a reply to message #555277] Thu, 02 September 2010 09:48 Go to previous message
mami  is currently offline mami Friend
Messages: 3
Registered: July 2010
Junior Member
Hi,

It's just about the registration process, me too I was obliged to work on another eclipse instance if i wanted create my Acceleotemplates, but not anymore.

So, if you want the metamodel to be recognized in the current instance (without launching another), you must add the plugin containing this metamodel to eclipse as follows:
- Go to "File" -> "Export..."
- In the Export wizard, go to "Plug-in Developmnent", select "Deployable plug-ins and fragments" and clic "Next",
- In the next page of wizard, select the plug-in you want deploy, check "Install into host. Repository" and clic "Finish".

Restart your eclipse and verify that the plug-in has been added (Eclipse -> About Eclipse SDK -> Installation Details -> Plug-ins)

If you follow the steps above, you can see appear the Ns URI of your metamodel in the URI list. Very Happy

Best regards,
Mami
Previous Topic:Log for programmaticaly MWE execution
Next Topic:Acceleo3 vs AndroMDA
Goto Forum:
  


Current Time: Thu Apr 25 15:21:01 GMT 2024

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

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

Back to the top