Copying derived attribute [message #1434835] |
Tue, 30 September 2014 13:19  |
Eclipse User |
|
|
|
Is it possible to keep the content of derived attributes when one copies instances of a model element from one editor or another? In my case, the metadata attribute is gone in the destination because it's a derived attribute.
Copied source:
<xxegsn:ArgumentPattern identifier="P1">
<node xsi:type="xxegsn:Goal" identifier="G1" description="Requirement (ID) {id1::int} holds">
<data xsi:type="xxegsn:PatternBehavior" metadata="hasParam(id1, int)" toBeInstantiated="true"/>
</node>
</xxegsn:ArgumentPattern>
Pasted target:
<xxegsn:ArgumentPattern identifier="P1">
<node xsi:type="xxegsn:Goal" identifier="G1" description="Requirement (ID) {id1::int} holds">
<data xsi:type="xxegsn:PatternBehavior" toBeInstantiated="true"/>
</node>
</xxegsn:ArgumentPattern>
|
|
|
|
|
Re: Copying derived attribute [message #1435132 is a reply to message #1434896] |
Wed, 01 October 2014 00:02  |
Eclipse User |
|
|
|
Al,
I assume that "it can't be set explicitly" implies its not changeable,
in which case you can't call eSet for that feature, which is how the
copier would copy it. Of course that seems contradictory to the fact
you show it in the serialization because normally the deserializer will
try to set it when its present. Also, you show the description present
in the copy, so certainly the derivation has the value it needs for its
derivation. Perhaps it's more an issue of which point in time you're
computing the derivation? If you look in
org.eclipse.emf.ecore.util.EcoreUtil.Copier.copy(EObject) you can see it
copies the features in the order in which they appear in the model, so
if a containment reference comes before an attribute, that reference's
containment tree will be copied before the attribute...
On 30/09/2014 9:30 PM, Al B wrote:
> Ed,
>
> It's derived from the content in the description attribute and it
> cannot be set explicitly or edited because it's read-only.
>
> description="Requirement (ID) {id1::int} holds"
|
|
|
Powered by
FUDForum. Page generated in 0.25941 seconds