|
Re: [ACCELEO] imput model type???? [message #667786 is a reply to message #667238] |
Mon, 02 May 2011 08:54   |
Eclipse User |
|
|
|
Radwane,
As long as your model can be read by EMF, you can use it with Acceleo. File extension does not matter.
If "nothing happened", make sure the templates you try to generate code with are indeed defined for the metamodel of your input model.
Laurent Goubet
Obeo
|
|
|
|
|
Re: [ACCELEO] imput model type???? [message #668338 is a reply to message #668327] |
Thu, 05 May 2011 09:25   |
Eclipse User |
|
|
|
hi ,
i tried to transformate model to text with acceleo tool .
i have my metamodel my.ecore and i instanciate a class in this metamodel nammed Root so now i have a file nammed Root.xmi and i have generate.mtl to generate java code so i have all files but the problem is::::
when i select Root.xmi as a input file nothing happned ( normally generate.mtl create another file.java but nothing happen) only when i choise my.ecore as input file (so i'm sur there no error in my generate.mtl) but that's can't help me because i must generate my file Root.xmi .
thx
|
|
|
Re: [ACCELEO] input model type???? [message #668793 is a reply to message #668338] |
Sat, 07 May 2011 14:14   |
Eclipse User |
|
|
|
hi
this is my file generator.mtl
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/3.0.0/UML')/]
[template public generate(aClass : Class)]
[file (aClass.name.concat('.java'), false)]
public class [aClass.name.toUpperFirst()/] {
[for (p: Property | aClass.attribute) separator('\n')]
private [p.type.name/] [p.name/];
[/for]
[for (p: Property | aClass.attribute) separator('\n')]
public [p.type.name/] get[p.name.toUpperFirst()/]() {
return this.[p.name/];
}
[/for]
[for (o: Operation | aClass.ownedOperation) separator('\n')]
public [o.type.name/] [o.name/]() {
// TODO should be implemented
}
[/for]
}
[/file]
[/template]
its ok if i choise input file .uml
but if i want to use my model .xmi i must change this ligne
[module generate('http://www.eclipse.org/uml2/3.0.0/UML')/]
but i dont know what i must write ?
|
|
|
Re: [ACCELEO] imput model type???? [message #668794 is a reply to message #668338] |
Sat, 07 May 2011 14:16  |
Eclipse User |
|
|
|
hi
this is my file generator.mtl
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/3.0.0/UML')/]
[template public generate(aClass : Class)]
[file (aClass.name.concat('.java'), false)]
public class [aClass.name.toUpperFirst()/] {
[for (p: Property | aClass.attribute) separator('\n')]
private [p.type.name/] [p.name/];
[/for]
[for (p: Property | aClass.attribute) separator('\n')]
public [p.type.name/] get[p.name.toUpperFirst()/]() {
return this.[p.name/];
}
[/for]
[for (o: Operation | aClass.ownedOperation) separator('\n')]
public [o.type.name/] [o.name/]() {
// TODO should be implemented
}
[/for]
}
[/file]
[/template]
its ok if i choise input file .uml
but if i want to use my model .xmi i must change this ligne
[module generate('http://www.eclipse.org/uml2/3.0.0/UML')/]
but i dont know what i must write ?
|
|
|
Powered by
FUDForum. Page generated in 0.04358 seconds