Removing element from a list with in an operation [message #1666209] |
Wed, 11 March 2015 11:39  |
Eclipse User |
|
|
|
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
|
|
|
|
Re: Removing element from a list with in an operation [message #1667683 is a reply to message #1666281] |
Thu, 12 March 2015 02:29  |
Eclipse User |
|
|
|
Steve,
Oh, it's that easy, I thought with the "eOpposite" you are also deleting the "oposite" when the item gets deleted and I do not want that, but that's not the case, for deleting the "Containment" has to be true.
So with the "eOposite" everything works fine, thank you very much Steve!
|
|
|
Powered by
FUDForum. Page generated in 0.04151 seconds