Hey, I am new to EMF/ECORE. I want to model a Has-A reference (Containment), but the containment should be available at runtime. So:
I have different classes that have a volume. so the volume is modeled in a class:
MyVolume
- depth: EDouble
- height: EDouble
- width: EDouble
- volume()
MyClass
- name: EString
- volume: MyVolume
If a create an Editor with the .genmodel, I can add to Class a Volume. but I want that volumne is a part of Class, so that the user can use the Class Volume as an attribute like name without creating it first. And depth, height and width should be displayed the same way as the attribute name in the properties view of the Editor.
Which property in model should be set or is there another way to archive the goal?
Thanks in advance
Steffen
I figured out a "solution":
- I created the class MyVolume, and then
- a datatype MyVolume that use My.impl.MyAttributeImpl as Instance Class Name.
- Then created in MyClass an attribute volume: MyVolume (Datatype).
- So I can acccess depth in the source code like this fixture.getVolume().getDepth();
- But only volume is show in the properties views in the Editor.
Any more ideas?
Steffen
Why not simple make
MyClass
extendMyVolume
, instead of having an attribute? I don't think this kind of union that you want is supported in any other way.