Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [ACCELEO] new metamodel(add new metamodel and use it)
[ACCELEO] new metamodel [message #668790] Sat, 07 May 2011 14:09 Go to next message
radwane  is currently offline radwane Friend
Messages: 27
Registered: April 2011
Junior Member
this is my file generator.mtl

[comment encoding = UTF-8 /]
[module generate('')/]
[template public generate(aClass : Class)]
[file ('.java'), false)]
public class [] {
[for (p: Property | aClass.attribute) separator('\n')]
private [] [];

[for (p: Property | aClass.attribute) separator('\n')]
public [] get[]() {
return this.[];

[for (o: Operation | aClass.ownedOperation) separator('\n')]
public [] []() {
// TODO should be implemented

its ok if i choise input file .uml
but if i want to use my model .xmi i must change this ligne
[module generate('')/]
but i dont know what i must write ?
Re: [ACCELEO] new metamodel [message #669399 is a reply to message #668790] Tue, 10 May 2011 08:17 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member


If you have a file with the "xmi" extension, I assume that you have created a dynamic instance of an element of a metamodel that you have created. If this is the case, then you need to define your Acceleo module on your own concepts not on UML.

You can see how it is done in this screenshot:

In this example, my Acceleo module is defined on myecore and myecore1 which are the URIs of my two metamodels. If you click on the root package of your metamodel in your ".ecore" file you can see its uri. Since you are using a dynamic metamodel, the URI will not appear in the wizard for the creation of a new module, you will have to edit the module after its creation.

The metamodel(s) used in the Acceleo module:
[module mymodule('myMetamodel1', 'myMetamodel2')]

it must be the same metamodel for your model (as I have explained it to leila already).

Since you and leila don't seem to understand this simple principle that I have already explained to you. Here is a nice screenshot explaining the same thing:

You see the difference with your situation ? You can't define a generator that will manipulate potatoes and carrots and give it a model about flying pigs and then expect a result!

Stephane Begaudeau, Obeo
Twitter: @sbegaudeau
Acceleo wiki:
Blogs: &
Previous Topic:an executable file
Next Topic:[ACCELEO] Overwriting existing files?
Goto Forum:

Current Time: Sun Mar 03 17:54:58 GMT 2024

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

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

Back to the top