Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 13:00 Go to next message
Artun Subasi is currently offline Artun SubasiFriend
Messages: 20
Registered: July 2009
Junior Member
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 14:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Resources that are removed from the ResourceSet reappear [message #498601 is a reply to message #498578] Tue, 17 November 2009 16:14 Go to previous messageGo to next message
Artun Subasi is currently offline Artun SubasiFriend
Messages: 20
Registered: July 2009
Junior Member
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 16:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
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


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Resources that are removed from the ResourceSet reappear [message #498717 is a reply to message #498618] Wed, 18 November 2009 10:35 Go to previous message
Artun Subasi is currently offline Artun SubasiFriend
Messages: 20
Registered: July 2009
Junior Member
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
Previous Topic:genmodel from xsd: error
Next Topic:[Teneo] sdo serialization and equality with idbag or index
Goto Forum:
  


Current Time: Thu Apr 25 16:37:40 GMT 2024

Powered by FUDForum. Page generated in 0.02844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top