Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Annotations of templates
[Acceleo] Annotations of templates [message #733891] Wed, 05 October 2011 21:22 Go to next message
macjariel is currently offline macjarielFriend
Messages: 1
Registered: October 2011
Junior Member
I'm new to the forum and also new to Acceleo. First, let me tell what am I trying to achieve with Acceleo.

I'm building a generic debugger of imperative DSL languages, built on XText and Acceleo. The main use case of my project is simple: you will provide XText grammar for your DSL Language and Acceleo templates to generate actual GPL code from the model. Only with a little effort you should be able to generate a debugger, that will allow you to put breakpoints into your DSL code, as well as using other debugging tools.

The thing that I am trying to solve is, that I need to somehow annotate the templates, so I could see this annotations when working with the traceability model. For instance I could write a template:

[template public generateUserCommandStatement(st : UserDefinedCommandStatement, name:String)]
[comment @subrutineCall /]
[name/].[userCommandMethodCall(st.command) /];

Then, when I work with traceability model, I would be able to tell whether the specific template has the subrutineCall annotation or not.

I wanted to ask for some recommendations how to achieve this - for example can I somehow inject the Acceleo mtl parsing mechanism? I could then create a new model that will contain links to module elements together with my annotations.

Thank you
Re: [Acceleo] Annotations of templates [message #735205 is a reply to message #733891] Tue, 11 October 2011 08:36 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member


If you want to add new information like "annotations" to your Acceleo module, I can recommend to way to do this:
1- You can enter your metadata in the documentation of the template. The information will be saved in the ".emtl" file and you will be able to access it during the generation. Once you get the traceability information, get the module element used for the generation and then get its parent module element (template or query) with eContainer().eContainer()...eContainer(). When you have the template or the query that has been used for the generation, you can access its documentation (getDocumentation()). You can see an example of a documented template here.

2- Acceleo modules are saved in ".emtl" files that are EMF models, you can create a new model that links to the model elements in the ".emtl" files or you can add annotation or anything else inside.


Stephane Begaudeau, Obeo

Twitter: @sbegaudeau
Google+: stephane.begaudeau
Acceleo Documentation:
Previous Topic:[Acceleo] Project jar dependencies in standalone compilation
Next Topic:[Xpand] Using dynamic emf metamodel with Xpand
Goto Forum:

Current Time: Mon Jun 05 21:29:58 GMT 2023

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

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

Back to the top