|
Re: Can a proxy be restored after it is resolved? [message #658272 is a reply to message #658268] |
Mon, 07 March 2011 16:26 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Pete,
Comments below.
Pete Ellis wrote:
> Hello everyone,
>
> Is there a technique available through the existing EMF API that would allow
> me to convert a referenced object back to its proxy state as it existed
> prior to resolution? I could obviously re-load the model... but I'm trying
> to incrementally restore proxy conditions (as if to "undo" the proxy
> resolutions) dynamically
>
Given some EObject x that's a resolved proxy held by feature f of object
y, you can use EcoreUtil.create(x.eClass()), cast it to InternalEObject,
call setEProxyURI with EcoreUtil.getURI(x), and then use
EcoreUtil.replace(y, f, x, <that proxy object>).
> Thanks for any thoughts on this,
>
> -Pete
>
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Can a proxy be restored after it is resolved? [message #658276 is a reply to message #658272] |
Mon, 07 March 2011 16:41 |
Pete Ellis Messages: 85 Registered: July 2009 |
Member |
|
|
Excellent! Many thanks, Ed, -Pete
> Pete,
>
> Comments below.
>
> Pete Ellis wrote:
>> Hello everyone,
>>
>> Is there a technique available through the existing EMF API that would
>> allow me to convert a referenced object back to its proxy state as it
>> existed prior to resolution? I could obviously re-load the model... but
>> I'm trying to incrementally restore proxy conditions (as if to "undo" the
>> proxy resolutions) dynamically
>>
> Given some EObject x that's a resolved proxy held by feature f of object
> y, you can use EcoreUtil.create(x.eClass()), cast it to InternalEObject,
> call setEProxyURI with EcoreUtil.getURI(x), and then use
> EcoreUtil.replace(y, f, x, <that proxy object>).
>> Thanks for any thoughts on this,
>>
>> -Pete
>>
>>
>>
>>
|
|
|
Powered by
FUDForum. Page generated in 0.01653 seconds