Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] creating something similar to a JET custom tag with acceleo
[Acceleo] creating something similar to a JET custom tag with acceleo [message #677399] Wed, 08 June 2011 11:57 Go to next message
Maxime Jeanmart is currently offline Maxime JeanmartFriend
Messages: 35
Registered: November 2010
Member
Hi all,

I relay here a question from one of my team members.
Here is the context. We are planning to switch from Jet templates to acceleo. The developer wants to reproduce some features he was using with Jet. In particular, he had a custom tag that was automatically resolving and adding the imports for java classes (don't ask me the difference with the standard jet import tag). How should he implement that function with Acceleo?

Here is the original question:
---------
> When generate a *.java file, It is difficult to computes all the imports to add in
> this .java file at begin.
>
> is there a way that automatically computes the imports to add according to the
> classes you use?
>
>
> for example :
>
> In JET, the user can make a custom tag, it like a pool, the user can add the
> imports string dynamically, then it flush its buffer to a file.
----------

thanks & regards,

Maxime
Re: [Acceleo] creating something similar to a JET custom tag with acceleo [message #677445 is a reply to message #677399] Wed, 08 June 2011 14:46 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Maxime,

With Acceleo, you can call Java code to do pretty much the same in order to keep a list of the import that are to be added to the Java file at the end of the generation. This is something we're planning to add "by default" (much like the "standard jet import tag"), but have not yet.

Laurent Goubet
Obeo
Re: [Acceleo] creating something similar to a JET custom tag with acceleo [message #677447 is a reply to message #677399] Wed, 08 June 2011 14:46 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Maxime,

In order to do this, you can compute the imports directly in Acceleo. You can see one example of this in this open source UML to Java generator for Acceleo 3 here. You can also use a Java service and compute the type used in the current class in Java and then return a list of those type to print the import in Acceleo.

Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Previous Topic:EvaluationException : Couldn't find operation
Next Topic:[Acceleo] get referencing objects to self
Goto Forum:
  


Current Time: Thu Dec 26 20:21:05 GMT 2024

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

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

Back to the top