0

In our project, we aim to model a system with series of components, with each component having a list of inputs and outputs. We want to differentiate inputs and outputs so we don't want it to be a big list of EFloats, rather we want to create a custom data type that defines the property as an input or output as well as contains the unit of measure for the value.

We created custom data classes in the Ecore model but can't assign them to the components since the attributes list contains default Ecore attributes.

Searching for "custom ecore attributes" returns results of general Ecore modeling information that doesn't quite address our question.

nullChar
  • 25
  • 6

2 Answers2

1

If the "custom data classes" you have created are EClasses, then you can assign them to the components via an "EReference". If they are custom data types, then you can assign them via an "EAttribute". Does that help?

user1292456
  • 778
  • 4
  • 12
0

I found the answer here in a post I missed previously.

How do I create an EAttribute whose data type is not an EMF class?

You can add a data type to eCore models by manually adding an eClassifiers entry to the *.ecore file. (I was unable to find a mechanism to do this through the Eclipse UI.)

For example:

<eClassifiers xsi:type="ecore:EDataType"
 name="MyClass" instanceClassName="my.package.MyClass"/>

This will make the class available as an option for the EType in the Properties editor for EAttributes. It does not appear to make it available for EReferences.

Community
  • 1
  • 1
nullChar
  • 25
  • 6