Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Unable to define multiple child creation extenders(Unable to extend metamodel by creating other metamodels importing it and defining subclasses, it works fine once, but not twice)
Unable to define multiple child creation extenders [message #1851949] Fri, 22 April 2022 14:07 Go to next message
Bruno Curzi-Laliberté is currently offline Bruno Curzi-LalibertéFriend
Messages: 14
Registered: January 2022
Junior Member
Hello all,

I am unable to define multiple child creation extenders for my metamodel.

I can do so once, but not twice, no matter how simple the extension is.

Let me give the simplest example with 3 metamodels.

A = base, B/C = extenders.

In A I define classes 1,2,3, 1 owns a reference to a 2 and a 3
In metamodels B and C, after adding a dependency to metamodel A, I define respectively classes extending 2 and 3

In my editor I can create a model of type A with a root element of type 1, right click add child and I can see 2,3 and the class extending 3 but not the class extending 2. Its as if whatever project extends A last has precedence over whatever extensions others declare.

Note that in my example there should be no conflict as metamodels B and C extend classes 2 and 3, I don't see how this could happen, I saw some bug reports linked in similar posts but didn't understand how to manually fix the models as indicated.

I will attach a zip containing the 3 models, I tested on my end that I can generate All and run as eclipse application successfully and reproduce the issue, you should be able to create children of type NewEClass2, NewClass3 & Ext2 but not of type Ext.

I noticed some errors in console but don't know what to make of it.
!ENTRY org.eclipse.emf.ecore 2 0 2022-04-22 10:05:38.888
!MESSAGE Both 'A' and 'B' register a package for 'http://www.example.org/a'

!ENTRY org.eclipse.emf.ecore 2 0 2022-04-22 10:05:38.894
!MESSAGE Both 'B' and 'C' register a package for 'http://www.example.org/a'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

!ENTRY org.eclipse.emf.ecore 2 0 2022-04-22 10:05:43.880
!MESSAGE a.impl.AFactoryImpl cannot be cast to a.AFactory
!STACK 0
java.lang.ClassCastException: a.impl.AFactoryImpl cannot be cast to a.AFactory
	at a.impl.AFactoryImpl.init(AFactoryImpl.java:30)

[Updated on: Fri, 22 April 2022 14:07]

Report message to a moderator

Re: Unable to define multiple child creation extenders [message #1851950 is a reply to message #1851949] Fri, 22 April 2022 14:14 Go to previous messageGo to next message
Bruno Curzi-Laliberté is currently offline Bruno Curzi-LalibertéFriend
Messages: 14
Registered: January 2022
Junior Member
I think my problem is similar to this, but I can't find any reference to "usedGenPackages" in my workspace https://www.eclipse.org/forums/index.php/m/1806735/#msg_1806735
Re: Unable to define multiple child creation extenders [message #1851951 is a reply to message #1851950] Fri, 22 April 2022 15:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33143
Registered: July 2009
Senior Member
When you do Reload.. from the context menu, on this page, you should choose packages from the other models. But your models are pretty messed up with the generation you did in the bad state which make it look like 'a' could also come from genmodel 'c'. It should be done like this and look like this:

index.php/fa/42009/0/

If the choices aren't there, use the Add... button to load the other *.genmodel.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to define multiple child creation extenders [message #1851952 is a reply to message #1851951] Fri, 22 April 2022 15:51 Go to previous message
Bruno Curzi-Laliberté is currently offline Bruno Curzi-LalibertéFriend
Messages: 14
Registered: January 2022
Junior Member
Thank you so much! I had no idea I could edit the genmodel to set the dependencies as references, it makes so much more sense now. I used to be able to extend the children without child extenders properties checked properly because the model was being copied and now it works as expected.
Previous Topic:[CDO] list=>database mapping: internal index is wrong in rare cases
Next Topic:Generate EMF from XSD failed with BPMN 2.0
Goto Forum:
  


Current Time: Thu May 02 05:47:07 GMT 2024

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

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

Back to the top