Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Papyrus UML to Java using Acceleo
Papyrus UML to Java using Acceleo [message #1016638] Thu, 07 March 2013 08:42 Go to next message
roshni rajagopal is currently offline roshni rajagopalFriend
Messages: 9
Registered: February 2013
Junior Member
I want to convert the papyrus UML model to java using Acceleo.
I followed the steps at http://wiki.eclipse.org/Acceleo/Getting_Started
, but get this error when i run generate.mtl "An internal error occurred during: "Launching Generate".
Could not find public template generateElement in module generate."

Here is the template file I use. What could be the issue?
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/4.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]
Re: Papyrus UML to Java using Acceleo [message #1017131 is a reply to message #1016638] Sat, 09 March 2013 17:48 Go to previous messageGo to next message
André Ribeiro is currently offline André RibeiroFriend
Messages: 55
Registered: January 2013
Member
Hi Roshni,

It seems you forgot to add the @main annotation.

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/4.0.0/UML')/]

[template public generate(aClass : Class)]

[comment @main /]
[file (aClass.name.concat('.java'), false)]
...


André Ribeiro
IST Lisbon
Portugal
Re: Papyrus UML to Java using Acceleo [message #1794552 is a reply to message #1017131] Sun, 02 September 2018 18:46 Go to previous messageGo to next message
Burak Karaduman is currently offline Burak KaradumanFriend
Messages: 84
Registered: July 2018
Member
André Ribeiro wrote on Sat, 09 March 2013 17:48
Hi Roshni,

It seems you forgot to add the @main annotation.

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/uml2/4.0.0/UML')/]

[template public generate(aClass : Class)]

[comment @main /]
[file (aClass.name.concat('.java'), false)]
...



Thank you so much sir! This is solved my problem! Thank you very much!.


But why this commet is needed ?

[Updated on: Sun, 02 September 2018 18:47]

Report message to a moderator

Re: Papyrus UML to Java using Acceleo [message #1794560 is a reply to message #1794552] Mon, 03 September 2018 05:30 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7681
Registered: July 2009
Senior Member
Hi

It looks like a design decision. The main template is different. It could have a special name such as Java's "main". it could have a reserved position - first. It could have a non-standard syntax. The designers chose an @main comment. (It might help if there was a warning for no-@main-comment.)

Regards

Ed Willink
Previous Topic:Load 2 differents input models an Acceleo template
Next Topic:Papyrus SysML model to text
Goto Forum:
  


Current Time: Mon Dec 30 16:03:00 GMT 2024

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

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

Back to the top