|
Re: How to copy a ResourceSet [message #422630 is a reply to message #422629] |
Thu, 11 September 2008 13:26 |
Eclipse User |
|
|
|
Originally posted by: cdamus.zeligsoft.com
Hi, SeB,
You can collect the contents of both resources into a single collection
of EObjects, and use the EcoreUtil.Copier to copy the whole collection.
This ensures that internal references in the copied graph are copied
correctly.
After the copy is complete, the Copier provides a mapping from the
original objects to their copies, so that you can populate new resources
with the copies of the contents, respectively, of the original resources.
HTH,
Christian
SeB.fr wrote:
> Hello,
>
> I need to copy a ResourceSet (that is 2 resources depending on each
> other) into memory in order to modify them without modifying the
> original Resources.
> I have looked a EcoreUtil to copy objects but I'd like the 2 copied
> resources to reference each other and I do not know how to do that?
>
> SeB.
>
|
|
|
Re: How to copy a ResourceSet [message #422639 is a reply to message #422630] |
Thu, 11 September 2008 15:40 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
SeB,
You could also use an EcoreUtil.Copier directly to call copyAll for each
resource's contents and when you're done with them all, call
copyReferences to make sure that all the cross references among all the
copied objects are copied as well...
Christian W. Damus wrote:
> Hi, SeB,
>
> You can collect the contents of both resources into a single
> collection of EObjects, and use the EcoreUtil.Copier to copy the whole
> collection. This ensures that internal references in the copied graph
> are copied correctly.
>
> After the copy is complete, the Copier provides a mapping from the
> original objects to their copies, so that you can populate new
> resources with the copies of the contents, respectively, of the
> original resources.
>
> HTH,
>
> Christian
>
> SeB.fr wrote:
>> Hello,
>>
>> I need to copy a ResourceSet (that is 2 resources depending on each
>> other) into memory in order to modify them without modifying the
>> original Resources.
>> I have looked a EcoreUtil to copy objects but I'd like the 2 copied
>> resources to reference each other and I do not know how to do that?
>>
>> SeB.
>>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
Re: How to copy a ResourceSet [message #422642 is a reply to message #422640] |
Thu, 11 September 2008 16:02 |
Ed Merks Messages: 33142 Registered: July 2009 |
Senior Member |
|
|
SeB,
It's not entirely clear how the resource itself should be copied. Just
create new ones with the same URI? But then there are issues like how
the content type (which will involve parsing the contents referenced by
the URI) determines the resource...
SeB.fr wrote:
> Thanks a lot.
>
> Would not it be great to have this method into the EcoreUtil class ?
>
>
> SeB.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03408 seconds