|
Re: Data Persistence in ELIST - ECLIPSE MODELING FRAMEWORK [message #1148286 is a reply to message #1148267] |
Mon, 21 October 2013 11:53 |
Ed Merks Messages: 33113 Registered: July 2009 |
Senior Member |
|
|
Arshad,
Comments below.
On 21/10/2013 1:36 PM, Arshad Adavani wrote:
> Hello all,
> I have an Elist of Some objects.
> Say Elist name is "eobjs" and it has 3 objects namely obj1, obj2, obj3.
>
> Based on some condition I should copy the data present in this list
> some other java.Util List say "list1".
>
> When I add obj1 from "eobjs" to "list1", No doubt it will be added to
> "list1" but it is getting deleted from "eobjs" which I don't want.
So you've no doubt omitted some important details. Likely your eobjs
list is a containment list and likely your target list is as well. An
EObject can be in at most one containment list, so yes, adding it to the
target list will remove it from the source list. That's unavoidable. If
you really want to "copy" the objects, you should use EcoreUtil.copyAll
to copy the source objects and then add those copies to the target.
Then the source and target lists will contain what you want, without the
objects being removed from the source.
>
> Can anyone suggest me some way ??
I'm not sure if copying is appropriate for your situation, but it is the
only way if both lists are containment lists.
>
> Thanks in advance :)
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Powered by
FUDForum. Page generated in 0.01694 seconds