Copying proxy objects [message #663368] |
Mon, 04 April 2011 15:26  |
Eclipse User |
|
|
|
Assuming I have the following:
1. eObjA and eObjB are EObjects
2. eObjA has a containment reference to eObjB
3. eObjB is a proxy (eIsProxy() returns true)
If I do:
Copier myCopier = new Copier(true, true);
Collection<EObject> myCopiedCollection = myCopier.copyAll(eObjA);
I assumed that the copyAll() method, since instantiated with resolveProxies set, would resolve the proxy URI's and then copy the object pointed to by the proxy URI during the copyAll() operation. It doesn't seem to be working that way. My proxy URI's are still pointing to the original objects. I want the eObjB proxy object pointed to to be copied, and then the new reference URI to point to that new copied object.
[Updated on: Mon, 04 April 2011 15:31] by Moderator
|
|
|
|
|
Re: Copying proxy objects [message #663425 is a reply to message #663421] |
Mon, 04 April 2011 20:53  |
Eclipse User |
|
|
|
Vinny,
If you call the getter on eObjA to fetch eObjB, does that resolve the
proxy or is eObjB.eIsProxy() true?
Vinny wrote:
> I override copyProxyURI() in the Copier class:
>
> protected void copyProxyURI(EObject eObject, EObject copyEObject) {
> if (eObject.eIsProxy()) {
> if (eObject.eResource().getResourceSet() != null) {
> System.out.println("Looks like the resource set is good.");
> } else {
> System.out.println("Looks like the resource set is NULL!!!");
> }
> ((InternalEObject) copyEObject)
> .eSetProxyURI(((InternalEObject) eObject).eProxyURI());
> }
> }
>
> On a copyAll(), I always see "Looks like the resource set is good" for
> my proxy objects.
> Also, The last line in the method is what sets the eProxyURI of the
> copied object to that of the original object, which points the URI to
> the original path. This seems to be where the issue is, or at least
> an indication of me doing something incorrectly.
|
|
|
Powered by
FUDForum. Page generated in 0.04508 seconds