Prime references do not accept subtypes
We are trying to allow an arbitrary graphmodel as a prime reference in the following way:
//some.mgl
import "platform:/plugin/de.jabc.cinco.meta.core.mgl.model/model/GraphModel.ecore" as gm
...
node GraphModelReference {
...
prime gm.GraphModel as model
}
This does not work, because the editor does not allow to add a graphmodel as prime reference.
The reason seems to be located in the generated file AddFeaturePrimeGraphModelReference.java
inside of the method canAdd
.
There the following condition is checked to determine if a prime reference can be added:
if(((element.eClass().getName().equals("GraphModel")
|| (element.eClass().getEAllSuperTypes().stream().anyMatch(_superClass -> _superClass.getName().equals("GraphModel")))
&& element.eClass().getEPackage().getNsURI().equals("http://www.jabc.de/cinco/gdl/graphmodel"))))
Here, it does check whether a superclass matches, but the nsURI
is always checked against that of the specified graph model which can obviously be different for subtypes.