Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Howto use Acceleo with a UML Profile
Howto use Acceleo with a UML Profile [message #1220885] Sun, 15 December 2013 07:15 Go to next message
Marc B is currently offline Marc B
Messages: 2
Registered: December 2013
Junior Member
Hi everybody !

I'm using Papyrus to create a (very simple) UML Profile. Then I used this profile to create a (very simple) model.
So a get two files : model.profile.uml and model.uml.

The question is : How to generate code from this model with Acceleo ?

I managed to generate code from a simple UML model with no particular profile. But I couldn't find any documentation on how to do it with a model with profile on the web...

Thanks. Smile
Re: Howto use Acceleo with a UML Profile [message #1221299 is a reply to message #1220885] Tue, 17 December 2013 05:48 Go to previous messageGo to next message
Siegfried Mising name is currently offline Siegfried Mising name
Messages: 39
Registered: August 2009
Member
Hi Marc,

first of all if you use UML-metamodel that will be OK. Profiling is something that can be done with UML.
Anyway, your model (model.uml) should know the model.profile. So everything will be all right, if you are doing some m2t on your model.

For instance youm may try something as follows:
[template public generatePackage(p : Package)]
[comment @main /]
[if (p.isStereotypeApplied(p.getApplicableStereotype('MVC-Profile::MVC')))]
[p.generateMain()/]
[/if]
[/template]

There is a MVC-Profile with a stereotype 'MVC'. If I find a stereotyped package, I will do some generation.

Got it so far?

Best regards,
Siegfried

[Updated on: Tue, 17 December 2013 07:30]

Report message to a moderator

Re: Howto use Acceleo with a UML Profile [message #1221496 is a reply to message #1221299] Tue, 17 December 2013 15:42 Go to previous messageGo to next message
Marc B is currently offline Marc B
Messages: 2
Registered: December 2013
Junior Member
Hi,
Thank you for your answer Smile

Well, actually, I don't see where to add these lines. :s

You're right, I profiled my model using the UML metamodel. So in Papyrus, my model.uml knows model.profile.uml.
But when I copy these files in Acceleo, I don't know how to "link" my model with the profile...

With a non-profiled UML model, to generate code, I add my model, create an new "Empty Generator" and choose Type value: "uml.Class". Then I get a default.mt file. Then, in the Outline, I right click my model, "Acceleo">"Select Template" and then "Acceleo">"Generate File(s)". It generates a file for each class I have in my model. [Btw, I'm not sure if it's the good way to do this...]
Now, in my profiled model, I don't have class anymore, but a stereotype (called my_class and extending Class). I'd like to do the same thing I did with Class, but with my_class.

Thanks for your help. Smile
Marc


Edit : Problem solved ! It works !!
It was just a pb of metamodel "http://www.eclipse.org/uml2/3.0.0/UML" instead of metamodel "http://www.eclipse.org/uml2/2.0.0/UML". The pb only took place in the profiled model, that's why it didn't work. Thanks for your help Siegfried Mising name !

[Updated on: Tue, 17 December 2013 16:55]

Report message to a moderator

Re: Howto use Acceleo with a UML Profile [message #1228480 is a reply to message #1221496] Tue, 07 January 2014 05:22 Go to previous message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can find additional information on this subject on the Acceleo wiki for custom profiles.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks



Previous Topic:Ecore property: Abstract/Interface
Next Topic:having empty line
Goto Forum:
  


Current Time: Thu Aug 28 05:23:03 EDT 2014

Powered by FUDForum. Page generated in 0.10708 seconds