Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Need some help to understand the process Papyrus => Acceleo => java code(A beginner in the wonderland of the model to text)
Need some help to understand the process Papyrus => Acceleo => java code [message #654937] Thu, 17 February 2011 16:49 Go to next message
Norbie  is currently offline Norbie Friend
Messages: 3
Registered: February 2011
Junior Member
Dear community,

Since yesterday I try to understand how to generate java code from a payrus UML model.

Well, I've downloaded the last Eclipse Modeling tools version.
I've successfully installed the acceleo and papyrus modules.

But now, for me it is the blank page.
After reading some (very old) documentation and reading some forums, I don't know how to do.

I can easily create an class diagram with Papyrus but after, nothing.

May I first create an java project ? (which is what I want) and after add a papyrus model ? and how to plug Acceleo ? And what mean the "Create Acceleo UI lancher project" ? this is for me ? to do what ?

Sorry but after reading various similar questions without answer I think that I'm not the only one who need some help.

Best regards,

Norbie
Re: Need some help to understand the process Papyrus => Acceleo => java code [message #654985 is a reply to message #654937] Thu, 17 February 2011 21:27 Go to previous messageGo to next message
Glenview Jeff is currently offline Glenview JeffFriend
Messages: 79
Registered: September 2010
Member
Without putting too much thought into this response, I would suggest you look at some of the Acceleo tutorials. UPDATE: I just downloaded Papyrus and verified that this works even without changing the default .mtl file.

Instead of creating your own meta-model (skip over this in the tutorials), and instead of instantiating a model from a custom meta-model, you'll use the UML meta-model and the model file you created from Papyrus.

This will come into play during the part where you create a new acceleo project (skip the part where you spawn a new Eclipse session). From Eclipse, Go to File, new, Acceleo Project, next, for the meta-model, click browse and use the UML2 one (I think it should be http://www.eclipse.org/uml2/3.0.0/UML).

For the generate for type field, try creating a generator for "class" type, and see the tutorials for examples on how to create generators.

When you're ready to test your generator, you'll right-click on the "main.mtl" file like you created in the tutorials, and select the papyrus model (the .uml file) you created along with the other parameters mentioned in the tutorials.

Jeff

[Updated on: Thu, 17 February 2011 22:20]

Report message to a moderator

Re: Need some help to understand the process Papyrus => Acceleo => java code [message #655012 is a reply to message #654985] Fri, 18 February 2011 00:01 Go to previous messageGo to next message
Norbie  is currently offline Norbie Friend
Messages: 3
Registered: February 2011
Junior Member

Dear Jeff,
Firstly,thank you for your quick reply. And secondly please excuse me for my bad english.

I've already try successfully this tutorial.
I don't understand why I need to write a generator for the "class type". There no default "UML to java" generator ? And after write the class generator, will I need another one for, example, for "enumertion type" ? etc. ?

Best regards,
Norbie
Re: Need some help to understand the process Papyrus => Acceleo => java code [message #655074 is a reply to message #654937] Fri, 18 February 2011 09:17 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 Norbie,

With Acceleo you have access to example of Acceleo generators. thanks to the "File -> New -> Examples) you can find an example of an UML to Java generator created with Acceleo 3. This generator is an example and it may not cover all your needs.

You can find documentation about Acceleo in the help menu (Help -> Help Content -> then select "Acceleo Model to Text") or the Acceleo wiki: http://wiki.eclipse.org/Acceleo

Finally, if you need even more documentation, you can find video presentations and video of the features of Acceleo on our website: http://docs.obeonetwork.com/acceleo/

Stephane Begaudeau, Obeo.

--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
Re: Need some help to understand the process Papyrus => Acceleo => java code [message #655124 is a reply to message #655074] Fri, 18 February 2011 12:32 Go to previous messageGo to next message
Norbie  is currently offline Norbie Friend
Messages: 3
Registered: February 2011
Junior Member
Hi Stephane,

Thanks a lot, with the Acceleo UML 2 java example I have my firsts lines of java.

But ... Very Happy

1- When I modify my UML model, I make the previously cited "right click" but my java files are not updated. An idea ?

2- In my very simple UML test model, I have an enumeration. The given .mtl file don't care about it. What I understand is that is just an example. But in previous version of Papyrus modeler, there was an "export to java code" module which was using acceleo too, including all transformations. Where are those complete generators ?

3- With the example, there is 2 eclipse projects :
- org.eclipse.acceleo.module.example.uml2java.helios
- org.eclipse.acceleo.module.example.uml2java.helios.ui

I use the first for generate java code with a right click on the "generateJava.mtl" file => "run as" => Lauch Acceleo application.
What is the second project (without generator ) ? But this is not the most important.

Many thanks in davance
Re: Need some help to understand the process Papyrus => Acceleo => java code [message #655158 is a reply to message #654937] Fri, 18 February 2011 14:09 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Norbie,

1- Check your run configuration to see if you are generating in the same folder and if you correctly take into account your uml model (Run -> Run Configurations)

2- In the previous version of the Papyrus modeler, I am pretty sure that the generator was based on Acceleo 2 which has a big UML to Java generator created by the CEA, Obeo and other contributors (If I remember correctly). This generator has not been migrated yet in Acceleo 3 because we are currently focusing on the improvement of Acceleo 3 with new features etc.

3- There are two projects :
- "org.eclipse.acceleo.module.example.uml2java.helios" is the Acceleo generator
- "org.eclipse.acceleo.module.example.uml2java.helios.ui" is a eclipse plugin which will create a menu in Eclipse to let you have your generator in your Eclipse without even seeing the generator. It will create a right click action on your *.uml model and you would just have to do right click -> acceleo -> Generate UML to Java.

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com
Previous Topic:[Acceleo 3] Problems with the 'automatically build' : false errors
Next Topic:[Acceleo] ClassNotFoundException if Runner is Acceleo Plug-in Application
Goto Forum:
  


Current Time: Sat May 04 17:08:34 GMT 2024

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

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

Back to the top