Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Start a module with a SET parameter
[Acceleo] Start a module with a SET parameter [message #764641] Mon, 12 December 2011 10:22 Go to next message
Timothy Marc is currently offline Timothy Marc
Messages: 547
Registered: July 2009
Senior Member
Hi all,

I was wondering, whether it is possible to invoke a main module with a set
of EObjects instead of only one EObject, something like this:

[tempate myModule ( elements : Set(Element))]
//...
[/template]

The generated API of the launcher allows only one single EObject. Can this
be somehow achieved?

Thanks for your hint.

Timothy
Re: [Acceleo] Start a module with a SET parameter [message #765225 is a reply to message #764641] Tue, 13 December 2011 11:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4003
Registered: July 2009
Senior Member
Hi

The root match condition is a variation point in transformation languages.

I think that, Acceleo iterates over all incoming root objects, so your
incoming set would be transformed element-wise.

Sets are not first class objects, so they are not really eligible for
matching.

I would recommend providing a first class object to contain your set,
otherwise you could live with Acceleo transforming each one by one, but
arrange for a guard so that only the first element produced a result on
behalf of all other elements.

Regards

Ed Willink


On 12/12/2011 07:22, Timothy Marc wrote:
> Hi all,
>
> I was wondering, whether it is possible to invoke a main module with a
> set of EObjects instead of only one EObject, something like this:
>
> [tempate myModule ( elements : Set(Element))]
> //...
> [/template]
>
> The generated API of the launcher allows only one single EObject. Can
> this be somehow achieved?
>
> Thanks for your hint.
>
> Timothy
Re: [Acceleo] Start a module with a SET parameter [message #765597 is a reply to message #765225] Wed, 14 December 2011 06:07 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
Hi Timothy,

The generated launcher is meant to be a simple starting point. It is sufficient for most cases, but it is extensible when you have more complex needs. What you wish to do is possible, but you'll have to customize the launcher in order to call the accuare APIs. Specifically, you should either


  1. Mark the "doGenerate" method "not generated" and change it to call the proper API
  2. Override the "generate" method directly


The "proper API" I mention is "AcceleoService.doGenerateTemplate(Module, String, List<? extends Object>, File, Monitor)" where the list of Object is the actual set of arguments you which to call the template with, instead of the standard "doGenerate" that iterates over the model for a corresponding element. Do not hesitate to ask if the API isn't clear on how to call it, or if you think we could simplify this Smile.

Laurent Goubet
Obeo
Previous Topic:[XPAND] Can't find references to metamodel from template
Next Topic:[Acceleo] How modular is the acceleo architecture?
Goto Forum:
  


Current Time: Wed Jul 23 10:01:52 EDT 2014

Powered by FUDForum. Page generated in 0.11941 seconds