Refer to an EAttribute of a different model [message #431484] |
Mon, 13 July 2009 05:35  |
Eclipse User |
|
|
|
Hello,
I need some help in understanding how I can use EMF for MDSD.
My idea is to use an EMF generated Ecore model M1 as data model and to
have another Ecore model M2 describing details of my application, e.g.
the structure of an editor.
M2 should be transformed to Java code by XPand.
How can I refer at modelling time (e.g. in the ecore editor) from M2 to
an EAttribute of M1, e.g. to say that a particular EDouble of the model
(instances at runtime) should be displayed in that particular text field
(described by M2) ?
Thanks for your answers
Sebastian
|
|
|
|
|
|
|
Re: Refer to an EAttribute of a different model [message #431494 is a reply to message #431492] |
Mon, 13 July 2009 10:46  |
Eclipse User |
|
|
|
Sebastian,
Comments below.
Sebastian Fuchs wrote:
> It works when I specify "modelProperty" as an EObject.
> When loading ressource
> platform:/plugin/org.eclipse.emf.ecore/model/Ecore in Editor.ecore
> to specify "modelProperty" as an EAttribute, I can't select any value
> in PersonEditor.xmi after reopening the xmi-editor.
Well, Ecore being it's own meta model does lead to some odd cases. But
I do expect your generated model to refer to the actual
EcorePackage.Literals.EATTRIBUTE instance and for loaded *.ecore models
to have objects that are an instance of that class...
>
> Overall it works now - thank you.
> Sebastian
>
>
> Ed Merks schrieb:
>> Sebastian,
>>
>> In all cases, if you use Load Resource... to load a resource, the
>> objects in that resource will be available for any feature whose type
>> allows that object. So loading Person.ecore into the
>> PersonEditor.xmi shoudl make the Person EClass and the name
>> EAttribute available...
>>
>>
>> Sebastian Fuchs wrote:
>>> Hi Joel,
>>>
>>> Unfortunately I am not sure WHICH metamodel you mean.
>>> Here is what I want:
>>>
>>> // the metamodel for all possible editors in applications
>>> // MM2
>>> Editor.ecore
>>> - EClass TextField
>>> - EAttribute EString 'label' // the label of the Field
>>> - EReference EAttribute 'modelProperty' // the Property of an
>>> (yet) unknown datamodel to show
>>>
>>> // the datamodel for a concrete application
>>> // M1
>>> Person.ecore
>>> - EClass Person
>>> - EAttribute EString 'name' // the name of a Person
>>>
>>>
>>> // model of a person editor of the concrete application
>>> // dynamic instance of Editor.ecore
>>> // M2
>>> PersonEditor.xmi
>>> - TextField
>>> - label = "Person's name"
>>> - modelProperty = ***Person.ecore#EAttribute('name')***
>>>
>>>
>>> So far I am not able to either select Person nor one of its attribute
>>> in the properties view of the PersonEditor.xmi-Editor.
>>> I even tried to let Person be an dynamic instance of the ecore-model
>>> (platform:/plugin/org.eclipse.emf.ecore/model/Ecore) without success.
>>>
>>> Sebastian
>>>
>>>
>>> Joel Greenyer schrieb:
>>>> Hello Sebastian,
>>>> to pinpoint the attribute value, you can reference the data object
>>>> and the EAttribute in the (meta-)model.
>>>>
>>>> Joel
|
|
|
Powered by
FUDForum. Page generated in 0.34296 seconds