|
Re: Removing element from a list with in an operation [message #1666281 is a reply to message #1666209] |
Wed, 11 March 2015 16:18 |
|
Hello,
I think that the easiest way is to update your metamodel to have the
Input "connectedTo" reference to be an "eOpposite" of the Output
"referenceBy" reference. This way when you add/remove a referenced
element to one of these references, the other one will be updated
accordingly. Therefore, in your tool you will only need the (already
working) Set task.
Regards,
Steve
Le 11/03/2015 16:39, Martin Schreiber a écrit :
>
> I do have 2 domain objects
> "Input" and "Output". Input does have a feature called "connectedTo"
> with type "Output", the "Output" does have a feature called
> "referencedBy" which is a 0..n relation to "Input".
>
> I do have a Delete operation on an "Relation based edge". Within the
> "Change Context" of this operation I do unset the "connectedTo" feature
> of the "Input" element which works fine. But I also need to remove the
> element from the referencedBy list.
> I tried it with:
> ChangeContext: "Browse Expression": self.connectedTo
> Set: feature: "referencedBy"; Value Expression:
> "[self.referencedBy->excluding(element)" /]
>
> It looks like that the "set" operation does try to call a setter method
> for the feature but since EMF does not generate a setter for a 0..n
> relations, the above stuff does not work. The ChangeContext stuff must
> be correct, because if I am setting another feature:
> Set: feature: "name"; Value Expression:
> "[self.referencedBy->excluding(element)->toString()" /]
> it works.
>
> How can I remove the an element from a collection?
>
> thanks
> martin
>
--
Steve Monnier - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Powered by
FUDForum. Page generated in 2.12108 seconds