Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » resource still out of sync after refreshLocal
resource still out of sync after refreshLocal [message #331261] Thu, 28 August 2008 16:16 Go to next message
Anton Pussep is currently offline Anton PussepFriend
Messages: 2
Registered: July 2009
Junior Member
Hi,

I am experiencing problems with the refreshLocal method. I call it right
after a file is modified using some java.io classes, but when I try to
open or delete this file afterwards, I get the message that the resource
is out of sync. However, if I refresh manually (F5), it works. Any idea
what might be wrong?

Here is the code (slightly modified), where modifyFilesInContainer
modifies the files, after that refreshLocal is called. I have no idea what
the problem could possibly be.

IContainer container = getWorkspace().getRoot().getFolder("test");
modifyFilesInContainer(container);
try {
container.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
// ...
}

Best,
Anton
Re: resource still out of sync after refreshLocal [message #331286 is a reply to message #331261] Thu, 28 August 2008 20:27 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
Anton Pussep wrote:
> IContainer container = getWorkspace().getRoot().getFolder("test");
> modifyFilesInContainer(container);
> try {
> container.refreshLocal(IResource.DEPTH_INFINITE, null);
> } catch (CoreException e) {
> // ...
> }

I know this is just sample code but I don't know how literal you're
being... any chance that refreshLocal is, in fact, throwing an exception
that is being ignored?
Re: resource still out of sync after refreshLocal [message #331288 is a reply to message #331286] Thu, 28 August 2008 23:33 Go to previous messageGo to next message
Anton Pussep is currently offline Anton PussepFriend
Messages: 2
Registered: July 2009
Junior Member
> I know this is just sample code but I don't know how literal you're
> being... any chance that refreshLocal is, in fact, throwing an exception
> that is being ignored?

No, the catch block adds the exception to the Error-Log View, so I am
pretty sure that no exception is thrown.
Re: resource still out of sync after refreshLocal [message #331292 is a reply to message #331261] Fri, 29 August 2008 06:49 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Anton Pussep wrote:
> Hi,
>
> I am experiencing problems with the refreshLocal method. I call it
> right after a file is modified using some java.io classes, but when I
> try to open or delete this file afterwards, I get the message that the
> resource is out of sync. However, if I refresh manually (F5), it
> works. Any idea what might be wrong?
Are you sure the changes via java.io are flushed and the file no longer
locked when you call refreshLocal? Also, are you doing the refresh in
the UI thread or some other thread that might refresh after the UI
accesses the file?

Dani
>
> Here is the code (slightly modified), where modifyFilesInContainer
> modifies the files, after that refreshLocal is called. I have no idea
> what the problem could possibly be.
>
> IContainer container = getWorkspace().getRoot().getFolder("test");
> modifyFilesInContainer(container);
> try {
> container.refreshLocal(IResource.DEPTH_INFINITE, null);
> } catch (CoreException e) {
> // ...
> }
>
> Best,
> Anton
>
Previous Topic:Enable disable action set
Next Topic:ILazyContentProvider updateElement(index) gets called for non-existent elements
Goto Forum:
  


Current Time: Mon Dec 30 18:05:15 GMT 2024

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

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

Back to the top