Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] How to load two models as input for generation?
[Acceleo] How to load two models as input for generation? [message #1008244] Mon, 11 February 2013 12:25 Go to next message
André Ribeiro is currently offline André Ribeiro
Messages: 48
Registered: January 2013
Member
Hi everyone!

I would like to load two models when launching the generation of a template. Is it possible?
Basically I've two UML diagrams that contain the information I need to properly generate a file.

Thanks in advance!


André Ribeiro
IST Lisbon
Portugal
Re: [Acceleo] How to load two models as input for generation? [message #1008364 is a reply to message #1008244] Tue, 12 February 2013 03:07 Go to previous messageGo to next message
Federico Toledo is currently offline Federico Toledo
Messages: 97
Registered: April 2012
Location: Ciudad Real, Spain
Member
Olá André

have you tried with this http://www.eclipse.org/forums/index.php/t/203781/

bye!
Re: [Acceleo] How to load two models as input for generation? [message #1008705 is a reply to message #1008364] Wed, 13 February 2013 11:22 Go to previous messageGo to next message
André Ribeiro is currently offline André Ribeiro
Messages: 48
Registered: January 2013
Member
Hi,

Maybe I wasn't clear. The 2 two diagrams that I need share the same metamodel.

Stephane Begaudeau wrote on Wed, 10 October 2012 09:10
Hi,

If you want to use multiple models in your generator, you should start with one of the models and then navigate to elements of the second one in the generator. If the second one is not loaded, you can use the code in the comment in the method "doGenerate" (//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model)).

Probably the information above is useful, but I'm just a beginner using acceleo.
If someone could provide me some help I would appreciate it very much.

Thanks.


André Ribeiro
IST Lisbon
Portugal
Re: [Acceleo] How to load two models as input for generation? [message #1009499 is a reply to message #1008705] Fri, 15 February 2013 03:33 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
Hi André,

What this basically means is that you do not "need" to load the two models if there are links between the two : the references will be loaded automatically as you navigate your models. For example if you have a two models "library.ecore" and "types.ecore"; library.ecore contains a class "Book", types.ecore contains a class "CirculatingItem". If the super-type of class "Book" is "CirculatingItem", then there is a "natural" link between your two models. You only need to load "library.ecore" and feed it to Acceleo : references will be automatically resolved when you try to access [book.eSuperTypes/] from Acceleo.

If you want to be absolutely sure that all your models are loaded when you generate, without relying on lazy loading, you can use the proposed code, calling "EcoreUtil.resolveAll(...)" before starting the generation.

Laurent Goubet
Obeo
Previous Topic:JET2 custom XPath function
Next Topic:[Acceleo] template/generation error listening
Goto Forum:
  


Current Time: Fri Aug 22 05:56:27 EDT 2014

Powered by FUDForum. Page generated in 0.02242 seconds