Can a proxy be restored after it is resolved? [message #658268] |
Mon, 07 March 2011 11:20  |
Eclipse User |
|
|
|
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
Thanks for any thoughts on this,
-Pete
|
|
|
Re: Can a proxy be restored after it is resolved? [message #658272 is a reply to message #658268] |
Mon, 07 March 2011 11:26   |
Eclipse User |
|
|
|
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
>
>
>
>
|
|
|
Re: Can a proxy be restored after it is resolved? [message #658276 is a reply to message #658272] |
Mon, 07 March 2011 11:41  |
Eclipse User |
|
|
|
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.02978 seconds