[Acceleo] Main [message #538202] |
Sun, 06 June 2010 07:09  |
Eclipse User |
|
|
|
Hi, I have some problems understanding how the mt2mtl creates the main entry point:
I had a module with a chain that called 4 templates, class, enum, interface and core.
When doing the mt2mtl it generates this file:
[module main('http://www.eclipse.org/uml2/2.1.0/UML')/]
[import org::acceleo::module::pim::uml21::gen::java::class /]
[import org::acceleo::module::pim::uml21::gen::java::enum /]
[import org::acceleo::module::pim::uml21::gen::java::interface /]
[import org::acceleo::module::pim::uml21::gen::java::validator::core /]
[template public main(c : Class)]
[comment @main /]
[comment Call the file block in 'class' /]
[ classJava() /]
[comment Call the file block in 'enum' /]
[ enumJava() /]
[comment Call the file block in 'interface' /]
[ interfaceJava() /]
[comment Call the file block in 'core' /]
[ validator() /]
[/template]
It gaves me errors when trying to call enumJava, interfaceJava and validator. I think this is because of the:
[template public main(c : Class)]
The problem is that core operates a UML model, enum operates Enumerations, interface operates Interfaces and class (the only one without errors) operates classes.
When doing the mt2mtl I choose generate for metamodel:
http://www.eclipse.org/uml2/2.1.0/UML
And for type:
Class
I tried generating for type "Model" and then all fails except for validator which is applied correctly to model.
How could I fix this? I mean, how can I tell Acceleo to apply class to classes, enum to enumerations, interface to interfaces and validator to model?
Should I generate different main points? Or should I call it on model and search for the classes and enumerations and interfaces present on the model?
Thank you very much!
|
|
|
Re: [Acceleo] Main [message #538299 is a reply to message #538202] |
Mon, 07 June 2010 04:36   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
--------------040408070105080600070809
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Daniel,
The main file we generate is but a stub : as you found out Acceleo 3
operates quite differently from Acceleo 2. I'd say the best way of doing
what you wish to is to call your template on Model and iterate to find
the other arguments :
[template public main(m : Model)]
[comment @main /]
[comment Call the file block in 'class' /]
[ m.packagedElements()->filter(Class).classJava() /]
[comment Call the file block in 'enum' /]
[ m.packagedElements()->filter(Enum).enumJava() /]
[comment Call the file block in 'interface' /]
[ m.packagedElements()->filter(Interface).interfaceJava() /]
[comment Call the file block in 'core' /]
[ validator() /]
[/template]
Laurent Goubet
Obeo
Daniel wrote:
> Hi, I have some problems understanding how the mt2mtl creates the main
> entry point:
>
> I had a module with a chain that called 4 templates, class, enum,
> interface and core.
>
> When doing the mt2mtl it generates this file:
>
> [module main('http://www.eclipse.org/uml2/2.1.0/UML')/]
>
> [import org::acceleo::module::pim::uml21::gen::java::class /]
> [import org::acceleo::module::pim::uml21::gen::java::enum /]
> [import org::acceleo::module::pim::uml21::gen::java::interface /]
> [import org::acceleo::module::pim::uml21::gen::java::validator::core /]
>
> [template public main(c : Class)]
> [comment @main /]
>
> [comment Call the file block in 'class' /]
> [ classJava() /]
>
> [comment Call the file block in 'enum' /]
> [ enumJava() /]
>
> [comment Call the file block in 'interface' /]
> [ interfaceJava() /]
>
> [comment Call the file block in 'core' /]
> [ validator() /]
>
> [/template]
>
> It gaves me errors when trying to call enumJava, interfaceJava and
> validator. I think this is because of the:
>
> [template public main(c : Class)]
>
> The problem is that core operates a UML model, enum operates
> Enumerations, interface operates Interfaces and class (the only one
> without errors) operates classes.
>
> When doing the mt2mtl I choose generate for metamodel:
>
> http://www.eclipse.org/uml2/2.1.0/UML
>
> And for type:
>
> Class
>
> I tried generating for type "Model" and then all fails except for
> validator which is applied correctly to model.
>
> How could I fix this? I mean, how can I tell Acceleo to apply class to
> classes, enum to enumerations, interface to interfaces and validator to
> model?
>
> Should I generate different main points? Or should I call it on model
> and search for the classes and enumerations and interfaces present on
> the model?
>
> Thank you very much!
>
--------------040408070105080600070809
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040408070105080600070809--
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.14760 seconds