Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » how to generate an acceleo plugin
how to generate an acceleo plugin [message #706257] Sun, 31 July 2011 03:19 Go to next message
Leonardo Kenji Shikida is currently offline Leonardo Kenji ShikidaFriend
Messages: 37
Registered: July 2009
Member
Hi

I must confess, I am quite confused, specially on the plugins dependencies.

Here is what I am doing (eclipse indigo modelling + acceleo)

1. new empty EMF project "EMF"
2. new ecore model in EMF/model "my.ecore" with just one EPackage (ns URI=http://www.xxx, ns prefix xxx and name xxx) and one EClass (MyEclass) with one EString attribute "name"
3. new EMF generator (My.genmodel) for the ecore model in EMF/model. Base package com.xyz
4. right click on the generator and generate all
5. click on EMF.Editor plugin.xml and launch in as an eclipse application (at this point, could I just use the plugin "export wizard" and install it in the "host repository" instead?)
6. in the new eclipse instance, create a new acceleo application and new main default template for metamodel URI http://www.xxx
7. at this point, the generated code complains of
        if (!isInWorkspace(com.xyz.xxx.XxxPackage.class)) {
            resourceSet.getPackageRegistry().put(com.xyz.xxx.XxxPackage.eINSTANCE.getNsURI(), com.xyz.xxx.XxxPackage.eINSTANCE);
        }

so in the MANIFEST dependencies, I add the plugin EMF (1.0.0.qualifier)
8. create a new acceleo UI launcher project, then I run its plugin.xml "launch as eclipse application" and create a third eclipse instance, then a new java project with a new Xxx model instance
9. I right click on the Xxx model and "Acceleo Model to Text" and "Generate Sample" and it works like a charm.

Then, in a second moment:

1. I change the ecore model, adding a new EClass "MyChildEClass" and a reference at MyEClass (Containment = true)
2. Right click on my.genmodel and "reload" the ecore model
3. Right click on my.genmodel and "Generate all again"
4. launch EMF.editor plugin.xml as an eclipse application again
5. launch acceleo ui plugin.xml as an eclipse application again
6. edit the old My.xxx model file and add a child
7. I right click on the Xxx model and "Acceleo Model to Text" and "Generate Sample" and it works like a charm.


is that the right way of doing things?

Basically, I am afraid of the memory requirements for [a] 3 eclipse instances and [b] bigger models

Best regards

Kenji

[Updated on: Sun, 31 July 2011 03:30]

Report message to a moderator

Re: how to generate an acceleo plugin [message #707123 is a reply to message #706257] Mon, 01 August 2011 09:10 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Kenji,

As a developper, this is indeed the "normal" way of doing things. Do note that the user of your generator will only have a single Eclipse, since he will have the metamodel plugin ("EMF"), the generator project (the one containing the Acceleo modules) and the Acceleo UI project installed in a single Eclipse.

However, there are indeed "shortcuts" as we don't always use three Eclipse instances either, and our goal is to simplify the work of the architect. First of all, you can use a metamodel that is located in your workspace as target of an Acceleo generation (see my answer on your post on metamodel registration : you can perfectly register something with a "project/model" URI). This is one less Eclipse. Second, you can launch the Acceleo generation without relying on the generated "UI Project" since you can right-click a module (".mtl" file) and use "Run As > Launch Acceleo Application". Please see the complete Getting Started basic tutorial for more information.

If you do use a generated Acceleo UI Project, then yes, launching a second Eclipse runtime instance is necessary.

Laurent Goubet
Obeo
Previous Topic:[Acceleo] Unable to run transformation
Next Topic:Calling acceleo from a java method (IField) instead of a java class (IFile)
Goto Forum:
  


Current Time: Fri Mar 29 15:44:44 GMT 2024

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

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

Back to the top