Unordered list of children [message #1744734] |
Thu, 29 September 2016 14:16  |
Eclipse User |
|
|
|
Hello,
I have the following ecore model:
...
<eClassifiers xsi:type="ecore:EClass" name="Pipeline">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
eType="#//Source" containment="true" resolveProxies="false"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="cleanse" ordered="false"
lowerBound="1" upperBound="-1" eType="#//Cleanse"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="transform" ordered="false"
lowerBound="1" eType="#//Transform"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
eType="#//Target" containment="true"/>
</eClassifiers>
...
Here the Cleanse and Transform elements will always preserve their order as defined in Ecore model, so if I added Transform, Cleanse, Transform, in the model I'll get
Pipeline
+ Cleanse
+ Transform
+ Transform
This is perfectly fine according to Ecore, but how should I change my Ecore model so that order of insertion would be preserved:
Pipeline
+ Transform
+ Cleanse
+ Transform
I tried this suggestion and the model updates how I want to, but my UI which uses one of the generated EMF editor does not function properly.
Thanks,
Alex
[Updated on: Thu, 29 September 2016 16:07] by Moderator
|
|
|
|
|
|
|
|
Re: Unordered list of children [message #1744857 is a reply to message #1744853] |
Fri, 30 September 2016 16:09  |
Eclipse User |
|
|
|
Ed Merks wrote on Fri, 30 September 2016 15:38Yes, EPackage.eClassifiers allow EClasses and EDataType to be referenced in arbitrary interspersed order. Similarly EClass.eStructuralFeatures allows EReferences and EAttributes to appear in interspersed order, and originally, in ancient history, it was modeled at two separate containment reference, so if you do getEAttribute().add(eAttribute) you'll hit this code:
@Override
public boolean add(EAttribute object)
{
System.err.println("Please fix your code to add using EClass.getEStructuralFeatures() instead of EClass.getEAttributes()");
return getEStructuralFeatures().add(object);
}
I understand. Thanks again!
|
|
|
Powered by
FUDForum. Page generated in 0.05605 seconds