Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin
[Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767213] Mon, 03 July 2017 15:32 Go to next message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Hello,

Is it possible to type the instances of the objects in the Acceleo editor with types defined in a personal Ecore, defined in a project of the Eclipse workspace, without installing it by a plugin in the Eclipse platform ?

I mean, i define a personal Ecore metamodel "myEcore" in my Eclipse workspace in the project "MyEcoreProject". This Ecore have the URI : "http://myEcore". In this Ecore, i have defined a class named "MyType", and i would like to use this type in the Acceleo editor, for example like this :

[query public myQuery(arg : Integer) : myEcore::MyType = ... /]


To do this, i know i have to add the URI of my Ecore in the [module] tag of my Acceleo module file, but by default Acceleo editor doesn't recognize this URI as a valid one. The only way i have found for now for Acceleo editor to know it is to generate myEcore code and to install it in the Eclipse platform as a plugin :

1) Is there a way Acceleo recognizes this URI without installing myEcore as a plugin in my Eclipse platform ?

2) When i have not installed my Ecore as a plugin, If i use the completion (CTRL+SPACE) in the [module] tag of my Acceleo file, it proposes me the URI '/MyEcoreProject/model/myEcore.ecore', and if i add it in the tag, it displays this URI is unknown by Acceleo. So why this URI is proposed and how to use it if we can ?

Thank you.
Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767216 is a reply to message #1767213] Mon, 03 July 2017 16:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Yes, but....

In principle you just need to make sure that your registrations are consistent which isn't easy and is even harder if you have an 'improved' metamodel as a project that you want to occlude a 'stable' version as a plugin.

IIRC you can use platform:/project/... to reference in the editor, then you 'just' need to ensure that platform:/project/... is registered in the template Java startup so that it works when you run.

If you search Bugzilla you will find that I have raised some bugs in this area. I don't think that they have all been resolved. IIRC if you have a simple usage with everything in one project, it may well work, but as soon as you need ../ relative referencing to work it can get interesting.

Regards

Ed Willink
Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767225 is a reply to message #1767216] Mon, 03 July 2017 17:56 Go to previous messageGo to next message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Sorry I understand what you are talking about, but i don't see how to do it correctly...

For your information :
- my metamodel is very simple : it just includes some simple classes and enumerations. I've stored it in an EmfProject containing the .ecore file, the associated .genmodel file, the generated Java code of the metamodel, and the useful files to define an Eclipse plugin (MANIFEST.MF).
- I just want to use this metamodel in my Acceleo modules : this metamodel is not used to create models stored in files, but only to create and manage internal structures in the Acceleo modules and during the Acceleo transformation. The model I use as input for the Acceleo transformation is a simple UML one. So i just need the Acceleo editor recognizes the elements defined in my metamodel during the edition, and that Acceleo executes my modules using my metamodel properly.
- I've referenced my "EmfProject" in the required plugins of my Acceleo project (in MANIFEST.MF)

So you mean that i can use :
[module generate('/EmfProject/model/MyEcore.ecore')]
isn't it or not ?

In the Java startup class, i don't really understand what to insert : in the "registerPackages" method, the documentation says "If the package is located in another project in your workspace, the plugin containing the package has not been register by EMF and Acceleo should register it automatically." This sentence means for me that Acceleo can locate the package of my metamodel alone, but it seems not... Nevertheless I've tried to add :

        if (!isInWorkspace(MyEcorePackage.class)) {
            // The normal package registration if your metamodel is in a plugin.
            resourceSet.getPackageRegistry().put(MyEcorePackage.eNS_URI, MyEcorePackage.eINSTANCE);
        }


and

        
        if (!isInWorkspace(MyEcorePackagePackage.class)) {
            // The normal package registration if your metamodel is in a plugin.
            resourceSet.getPackageRegistry().put("/EmfProject/model/MyEcore.ecore", MyEcorePackagePackage.eINSTANCE);
        }

but it doesn't work : Acceleo editor still does not know '/EmfProject/model/MyEcore.ecore' neither 'http://myEcore' (it is the value of MyEcorePackage.eNS_URI). Which part of the Acceleo project is editable to have an effect on the Acceleo editor ?

I've tried too to clean the projects and restart Eclipse, but same result.

So where i've done wrong ?

Thank you.

[Updated on: Mon, 03 July 2017 18:30]

Report message to a moderator

Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767227 is a reply to message #1767225] Mon, 03 July 2017 18:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Providing minute fractions of a repro does not encourage any effort to help you. I wrote that it can work but can be hard. Sorry you may be on your own. My recollection of Acceleo is four years old since I migrated away because of the difficulties of co-existing project and plugin models.

Regards

Ed Willink
Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767235 is a reply to message #1767227] Mon, 03 July 2017 23:52 Go to previous messageGo to next message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Ok so it seems installing the plugin into the platform is the easiest way... shame... :/

Thank you.
Regards.
Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767255 is a reply to message #1767235] Tue, 04 July 2017 08:37 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

We do not recommand trying to develop your modules with the metamodel in your workspace. As Ed mentionned it can work... but it is very error prone and subject to bugs. Installing the plugin or, easier for development time if your metamodel is still subject to changes, using a runtime eclipse to develop your modules (have your metamodel in first eclipse then run a new eclipse application from there and develop your modules in that second one), is the recommanded way.

Laurent Goubet
Obeo
Re: [Acceleo] Use Ecore metamodel in the Acceleo editor without installing a plugin [message #1767349 is a reply to message #1767255] Tue, 04 July 2017 22:13 Go to previous message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Hi !

Ok, thank you for this information.

Regards.
Previous Topic:[Acceleo] Getting object's textual reference
Next Topic:[Acceleo] Strange behavior for queries using the "iterate" method
Goto Forum:
  


Current Time: Tue Mar 19 06:29:37 GMT 2024

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

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

Back to the top