Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] eContainer returns invalid class
[Acceleo] eContainer returns invalid class [message #664905] Tue, 12 April 2011 09:20 Go to next message
Melanie Bats is currently offline Melanie Bats
Messages: 21
Registered: July 2009
Junior Member
Hello,

I am writing a template with Acceleo 3.1.0M5 for generating a C file from an ecore model and I meet a weird behaviour. In my template, I just call the eContainer on my object like this :
[iConnectedData.eContainer()/]

If I run my template from eclipse as plugin I obtain :
RteLGenModel.impl.RteLGenReceiverPortImpl (shortName: ev_Mode_Change_Realized_rp, longName: null, category: ) (portInterface: ev_Mode_Change_Realized_interface) which is the expected result

but

If I run my template from a standalone java application, the result is :
org.eclipse.emf.ecore.impl.DynamicEObjectImpl (eClass: org.eclipse.emf.ecore.impl.EClassImpl (name: OclInvalid_Class) (instanceClassName: null) (abstract: false, interface: false))

Do you have an explanation? and a solution in order that the eContainer works in standalone mode?

Thanks,
Melanie
Re: [Acceleo] eContainer returns invalid class [message #664970 is a reply to message #664905] Tue, 12 April 2011 12:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25744
Registered: July 2009
Senior Member
Melanie,

It sounds like in one case it finds the model (because its nsURI is
registered in the plugin.xml) but in the other case it doesn't, because
you have to register it manually. I.e., calling
XyxPackage.eINSTANCE.eClass() for every package you'll be using. It's
usually easier to run as a headless Eclipse application so that all the
normal registrations are just there...


Melanie Bats wrote:
> Hello,
>
> I am writing a template with Acceleo 3.1.0M5 for generating a C file
> from an ecore model and I meet a weird behaviour. In my template, I
> just call the eContainer on my object like this :
> [iConnectedData.eContainer()/]
>
> If I run my template from eclipse as plugin I obtain :
> RteLGenModel.impl.RteLGenReceiverPortImpl (shortName:
> ev_Mode_Change_Realized_rp, longName: null, category: )
> (portInterface: ev_Mode_Change_Realized_interface) which is the
> expected result
>
> but
> If I run my template from a standalone java application, the result is :
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl (name: OclInvalid_Class)
> (instanceClassName: null) (abstract: false, interface: false))
>
> Do you have an explanation? and a solution in order that the
> eContainer works in standalone mode?
>
> Thanks,
> Melanie
Re: [Acceleo] eContainer returns invalid class [message #664971 is a reply to message #664905] Tue, 12 April 2011 12:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 3842
Registered: July 2009
Senior Member
Hi Melanie


>
> If I run my template from a standalone java application, the result is :
> org.eclipse.emf.ecore.impl.DynamicEObjectImpl (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl (name: OclInvalid_Class)
> (instanceClassName: null) (abstract: false, interface: false))
which means 'invalid'
>
> Do you have an explanation? and a solution in order that the
> eContainer works in standalone mode?
There have been significant fixes to Standalone operation in M6 and M6a.
I recommend giving them a try.

Regards

Ed Willink
Re: [Acceleo] eContainer returns invalid class [message #665060 is a reply to message #664905] Wed, 13 April 2011 03:26 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Melanie,

If you are running in stand alone, you may have to register the metamodel by yourself (see the registerPackages method in the java launcher of your generator for an example). But I agree with Edward Willink, you should give a try to the 3.1M6 Smile


Stephane Begaudeau, Obeo
--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com



Re: [Acceleo] eContainer returns invalid class [message #665608 is a reply to message #665060] Fri, 15 April 2011 05:17 Go to previous message
Melanie Bats is currently offline Melanie Bats
Messages: 21
Registered: July 2009
Junior Member
Hello,

In fact the metamodel registration was good and the problem is solved by using the M6a.

Thanks all for your help,
Melanie
Previous Topic:[Acceleo3] Strange template invocation error
Next Topic:[Acceleo] Parameters of one operation
Goto Forum:
  


Current Time: Thu Apr 17 11:47:32 EDT 2014

Powered by FUDForum. Page generated in 0.05894 seconds