Home » Modeling » EMF » Resources that are removed from the ResourceSet reappear
| Resources that are removed from the ResourceSet reappear [message #498550] |
Tue, 17 November 2009 08:00  |
Eclipse User |
|
|
|
Hello,
I am working on the navigator part of our application. The entities that
are seen on the navigator correspond to both Eclipse platform resources
and EObjects which are persisted in EMF resources.
I recently implemented a delete action. Deleting an entity first updates
the EMF model, then removes the EMF resource from the ResourceSet.
Finally it deletes the Eclipse platform resources. (It also deletes all
proxy references to the deleted entity.)
After the last line of the delete action, the ResourceSet does not
contain the deleted entity. However, after some time it reappears in the
ResourceSet, which causes problems in the future if I try to create a
new entity with the same URI. I couldn't find out when the resource is
readded to the ResourceSet by debugging because I get stuck in an event
loop after my action. As soon as I press resume to get out of the event
loop, the resource is back there...
I can't find out why the resource reappears in the ResourceSet. I could
probably solve my problems with workarounds (for example by reloading
the resource to make sure the old one is not loaded), but I am searching
for a better way. Plus, I am very curious. :)
Artun Subasi
|
|
|
| Re: Resources that are removed from the ResourceSet reappear [message #498578 is a reply to message #498550] |
Tue, 17 November 2009 09:48   |
Eclipse User |
|
|
|
Artun,
Comments below.
Artun Subasi wrote:
> Hello,
>
> I am working on the navigator part of our application. The entities
> that are seen on the navigator correspond to both Eclipse platform
> resources and EObjects which are persisted in EMF resources.
>
> I recently implemented a delete action. Deleting an entity first
> updates the EMF model, then removes the EMF resource from the
> ResourceSet. Finally it deletes the Eclipse platform resources. (It
> also deletes all proxy references to the deleted entity.)
>
> After the last line of the delete action, the ResourceSet does not
> contain the deleted entity. However, after some time it reappears in
> the ResourceSet, which causes problems in the future if I try to
> create a new entity with the same URI. I couldn't find out when the
> resource is readded to the ResourceSet by debugging because I get
> stuck in an event loop after my action. As soon as I press resume to
> get out of the event loop, the resource is back there...
Set a breakpoint in ResourceSetImpl.demandCreateResource
>
>
> I can't find out why the resource reappears in the ResourceSet.
No doubt a proxy is being resolved causing the references resource to be
loaded again.
> I could probably solve my problems with workarounds (for example by
> reloading the resource to make sure the old one is not loaded), but I
> am searching for a better way. Plus, I am very curious. :)
>
> Artun Subasi
|
|
|
| Re: Resources that are removed from the ResourceSet reappear [message #498601 is a reply to message #498578] |
Tue, 17 November 2009 11:14   |
Eclipse User |
|
|
|
Thanks Ed. You are quick, as always. =)
You were right. A proxy is causing the references to be loaded again. I
was sure that I removed all proxies from my data model. The problem
seems to be the viewer (and ViewerRefresh).
My AdapterFactoryContentProvider$ViewerRefresh calls the refresh method
with a viewer notification that the EObject was removed from the data
model. This causes the object to be resolved again and it appears in the
resource set.
I think this ViewerRefresh method is called asynchronously with
Display.runAsync, therefore it happens after my operation terminates. Is
there a way to prevent this?
Ed Merks wrote:
> Artun,
>
> Comments below.
>
>
> Artun Subasi wrote:
>> Hello,
>>
>> I am working on the navigator part of our application. The entities
>> that are seen on the navigator correspond to both Eclipse platform
>> resources and EObjects which are persisted in EMF resources.
>>
>> I recently implemented a delete action. Deleting an entity first
>> updates the EMF model, then removes the EMF resource from the
>> ResourceSet. Finally it deletes the Eclipse platform resources. (It
>> also deletes all proxy references to the deleted entity.)
>>
>> After the last line of the delete action, the ResourceSet does not
>> contain the deleted entity. However, after some time it reappears in
>> the ResourceSet, which causes problems in the future if I try to
>> create a new entity with the same URI. I couldn't find out when the
>> resource is readded to the ResourceSet by debugging because I get
>> stuck in an event loop after my action. As soon as I press resume to
>> get out of the event loop, the resource is back there...
> Set a breakpoint in ResourceSetImpl.demandCreateResource
>>
>>
>> I can't find out why the resource reappears in the ResourceSet.
> No doubt a proxy is being resolved causing the references resource to be
> loaded again.
>> I could probably solve my problems with workarounds (for example by
>> reloading the resource to make sure the old one is not loaded), but I
>> am searching for a better way. Plus, I am very curious. :)
>>
>> Artun Subasi
|
|
|
| Re: Resources that are removed from the ResourceSet reappear [message #498618 is a reply to message #498601] |
Tue, 17 November 2009 11:54   |
Eclipse User |
|
|
|
Artun,
Comments below.
Artun Subasi wrote:
> Thanks Ed. You are quick, as always. =)
>
> You were right. A proxy is causing the references to be loaded again.
> I was sure that I removed all proxies from my data model. The problem
> seems to be the viewer (and ViewerRefresh).
>
> My AdapterFactoryContentProvider$ViewerRefresh calls the refresh
> method with a viewer notification that the EObject was removed from
> the data model. This causes the object to be resolved again and it
> appears in the resource set.
>
> I think this ViewerRefresh method is called asynchronously with
> Display.runAsync, therefore it happens after my operation terminates.
> Is there a way to prevent this?
It sounds like the selection is being restored so likely resetting the
selection to a non-deleted object will avoid this.
>
> Ed Merks wrote:
>> Artun,
>>
>> Comments below.
>>
>>
>> Artun Subasi wrote:
>>> Hello,
>>>
>>> I am working on the navigator part of our application. The entities
>>> that are seen on the navigator correspond to both Eclipse platform
>>> resources and EObjects which are persisted in EMF resources.
>>>
>>> I recently implemented a delete action. Deleting an entity first
>>> updates the EMF model, then removes the EMF resource from the
>>> ResourceSet. Finally it deletes the Eclipse platform resources. (It
>>> also deletes all proxy references to the deleted entity.)
>>>
>>> After the last line of the delete action, the ResourceSet does not
>>> contain the deleted entity. However, after some time it reappears in
>>> the ResourceSet, which causes problems in the future if I try to
>>> create a new entity with the same URI. I couldn't find out when the
>>> resource is readded to the ResourceSet by debugging because I get
>>> stuck in an event loop after my action. As soon as I press resume to
>>> get out of the event loop, the resource is back there...
>> Set a breakpoint in ResourceSetImpl.demandCreateResource
>>>
>>>
>>> I can't find out why the resource reappears in the ResourceSet.
>> No doubt a proxy is being resolved causing the references resource to
>> be loaded again.
>>> I could probably solve my problems with workarounds (for example by
>>> reloading the resource to make sure the old one is not loaded), but
>>> I am searching for a better way. Plus, I am very curious. :)
>>>
>>> Artun Subasi
|
|
|
| Re: Resources that are removed from the ResourceSet reappear [message #498717 is a reply to message #498618] |
Wed, 18 November 2009 05:35  |
Eclipse User |
|
|
|
Thanks Ed,
Right again! Resetting the selection to a non-deleted object solved the
problem.
Ed Merks wrote:
> Artun,
>
> Comments below.
>
> Artun Subasi wrote:
>> Thanks Ed. You are quick, as always. =)
>>
>> You were right. A proxy is causing the references to be loaded again.
>> I was sure that I removed all proxies from my data model. The problem
>> seems to be the viewer (and ViewerRefresh).
>>
>> My AdapterFactoryContentProvider$ViewerRefresh calls the refresh
>> method with a viewer notification that the EObject was removed from
>> the data model. This causes the object to be resolved again and it
>> appears in the resource set.
>>
>> I think this ViewerRefresh method is called asynchronously with
>> Display.runAsync, therefore it happens after my operation terminates.
>> Is there a way to prevent this?
> It sounds like the selection is being restored so likely resetting the
> selection to a non-deleted object will avoid this.
>>
>> Ed Merks wrote:
>>> Artun,
>>>
>>> Comments below.
>>>
>>>
>>> Artun Subasi wrote:
>>>> Hello,
>>>>
>>>> I am working on the navigator part of our application. The entities
>>>> that are seen on the navigator correspond to both Eclipse platform
>>>> resources and EObjects which are persisted in EMF resources.
>>>>
>>>> I recently implemented a delete action. Deleting an entity first
>>>> updates the EMF model, then removes the EMF resource from the
>>>> ResourceSet. Finally it deletes the Eclipse platform resources. (It
>>>> also deletes all proxy references to the deleted entity.)
>>>>
>>>> After the last line of the delete action, the ResourceSet does not
>>>> contain the deleted entity. However, after some time it reappears in
>>>> the ResourceSet, which causes problems in the future if I try to
>>>> create a new entity with the same URI. I couldn't find out when the
>>>> resource is readded to the ResourceSet by debugging because I get
>>>> stuck in an event loop after my action. As soon as I press resume to
>>>> get out of the event loop, the resource is back there...
>>> Set a breakpoint in ResourceSetImpl.demandCreateResource
>>>>
>>>>
>>>> I can't find out why the resource reappears in the ResourceSet.
>>> No doubt a proxy is being resolved causing the references resource to
>>> be loaded again.
>>>> I could probably solve my problems with workarounds (for example by
>>>> reloading the resource to make sure the old one is not loaded), but
>>>> I am searching for a better way. Plus, I am very curious. :)
>>>>
>>>> Artun Subasi
|
|
|
Goto Forum:
Current Time: Sat Nov 08 04:33:21 EST 2025
Powered by FUDForum. Page generated in 0.04931 seconds
|