|
|
Re: Creating child objects of a type from another model? [message #662181 is a reply to message #662178] |
Tue, 29 March 2011 15:47 |
Dan Pollitt Messages: 55 Registered: August 2010 |
Member |
|
|
Hi Ed,
I did make the changes to the ecore model after I had already created
the GenModel (i.e. before regenerating over teh top of my existing
generated code), but I went into the GenModel in the editor afterwards
and checked that the "Edit/Children" and "Edit/Create Child" properties
of the features were set to "true".
By your question - I assume this should just "work" assuming I've set
the flags correctly?
Thanks,
Dan
On 29/03/2011 16:28, Ed Merks wrote:
> Dan,
>
> Do the corresponding GenFeatures for the schema and message features
> indicate that children should be supported? I.e., did you maybe change
> these to containment after you'd already created the GenModel?
>
>
> Dan Pollitt wrote:
>> Hi all,
>>
>> I have a modelled type "MessageAction" and I'd like to reuse EObject &
>> EPackage from Ecore as the eReferenceTypes of two EReferences of
>> Message - to represent the "payload" and "schema" respectively, e.g:
>>
>> ...
>> <eClassifiers xsi:type="ecore:EClass" name="MessageAction"
>> abstract="true" interface="true"
>> eSuperTypes="#//test/Action">
>> <eStructuralFeatures xsi:type="ecore:EReference" name="schema"
>> upperBound="-1"
>> eType="ecore:EClass
>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Package "
>> containment="true"/>
>> <eStructuralFeatures xsi:type="ecore:EReference" name="message"
>> eType="ecore:EClass
>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Object "
>> containment="true"/>
>> </eClassifiers>
>> ...
>>
>> I can't seem to persuade the generated .edit code to offer up
>> EPackages or EObjects as candidate children or properties of instances
>> of subclasses of the MessageAction type.
>>
>> My question is: what should my approach be if I wanted to customise
>> the generated edit/editor to allow a user to create an EPackage
>> instance as a child of a MessageAction, or am I barking up the wrong
>> tree to reuse EPackage and EObject in this way? I had hoped to reuse
>> the ecore.edit item providers.
>>
>> Thanks,
>> Dan
|
|
|
Re: Creating child objects of a type from another model? [message #662192 is a reply to message #662181] |
Tue, 29 March 2011 16:02 |
Dan Pollitt Messages: 55 Registered: August 2010 |
Member |
|
|
ok apologies - somehow I'd managed to mess up the supertype hierarchy so
the type (MessageAction) with these references was missed out!
Looking much better now (in the generated code at least)
Many thanks for the help,
Dan
On 29/03/2011 16:47, Dan Pollitt wrote:
> Hi Ed,
>
> I did make the changes to the ecore model after I had already created
> the GenModel (i.e. before regenerating over teh top of my existing
> generated code), but I went into the GenModel in the editor afterwards
> and checked that the "Edit/Children" and "Edit/Create Child" properties
> of the features were set to "true".
>
> By your question - I assume this should just "work" assuming I've set
> the flags correctly?
>
> Thanks,
> Dan
>
> On 29/03/2011 16:28, Ed Merks wrote:
>> Dan,
>>
>> Do the corresponding GenFeatures for the schema and message features
>> indicate that children should be supported? I.e., did you maybe change
>> these to containment after you'd already created the GenModel?
>>
>>
>> Dan Pollitt wrote:
>>> Hi all,
>>>
>>> I have a modelled type "MessageAction" and I'd like to reuse EObject &
>>> EPackage from Ecore as the eReferenceTypes of two EReferences of
>>> Message - to represent the "payload" and "schema" respectively, e.g:
>>>
>>> ...
>>> <eClassifiers xsi:type="ecore:EClass" name="MessageAction"
>>> abstract="true" interface="true"
>>> eSuperTypes="#//test/Action">
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="schema"
>>> upperBound="-1"
>>> eType="ecore:EClass
>>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Package "
>>> containment="true"/>
>>> <eStructuralFeatures xsi:type="ecore:EReference" name="message"
>>> eType="ecore:EClass
>>> platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//E Object "
>>> containment="true"/>
>>> </eClassifiers>
>>> ...
>>>
>>> I can't seem to persuade the generated .edit code to offer up
>>> EPackages or EObjects as candidate children or properties of instances
>>> of subclasses of the MessageAction type.
>>>
>>> My question is: what should my approach be if I wanted to customise
>>> the generated edit/editor to allow a user to create an EPackage
>>> instance as a child of a MessageAction, or am I barking up the wrong
>>> tree to reuse EPackage and EObject in this way? I had hoped to reuse
>>> the ecore.edit item providers.
>>>
>>> Thanks,
>>> Dan
>
|
|
|
Powered by
FUDForum. Page generated in 0.04060 seconds