|
|
|
Re: derived containments and eContents [message #484607 is a reply to message #484500] |
Tue, 08 September 2009 13:43 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Knut,
Comments below.
Knut Wannheden wrote:
> Hi Ed,
>
> Thanks for the reply.
>
> Ed Merks wrote:
>> Knut Wannheden wrote:
>>> I could not find anything about this in the EMF book? What is the
>>> reasoning behind this?
>> Derived is really meant to mark features that are computed from the
>> values of other features. Given that EObjects really do know their
>> eContainer and even their eContainmentFeature it's not really
>> possible for a containment reference to be derived because this would
>> lead to an inconsistency...
>
> Makes sense. Should there be a corresponding validation?
There are cases, such as delegation to a feature map, where the
containment is validly derived. It's these kinds of cases where the
eContents() wants to preserve the feature map's order and hence it's
special handling of derived.
>
>>> As an alternative I think I could use a non "derived" containment
>>> and have an adapter which updates the contents of the reference as
>>> required (i.e. when the underlying parts of the model change). Is
>>> that the recommended way to do this?
>> Perhaps you could spell out in more detail the nature of the problem
>> you're trying to solve because it's not immediately obvious to be
>> what to suggest...
>
> I would like to add GMF side-affixed children to a node figure. AFAIK
> the model elements corresponding to the side-affixed children have to
> be contained by the element corresponding to the node figure. However,
> in my model there are no real child elements, so for this purpose I
> create new transient elements. These transient elements are really
> just references to other model elements, which are directly or
> indirectly referenced by the model element of the node. But these real
> model elements are not directly contained by the main element...
It kind of sucks to have to "butcher" the model to make a viewer happy.
Perhaps you should model these placeholder elements as real containment
references, not derived ones and have them hold non-containment
references to other things...
>
> Regards,
>
> --knut
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.02673 seconds