### Eclipse Workspace Patch 1.0 #P org.eclipse.core.resources Index: src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java,v retrieving revision 1.130 diff -u -r1.130 FileSystemResourceManager.java --- src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 12 Jan 2011 09:38:29 -0000 1.130 +++ src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java 4 Feb 2011 22:34:46 -0000 @@ -621,10 +621,12 @@ return projectInfo.getLocalSyncInfo() == getStore(descriptionFile).fetchInfo().getLastModified(); } - /* (non-Javadoc) + /** * Returns true if the given resource is synchronized with the file system * to the given depth. Returns false otherwise. * + * Any discovered out-of-sync resources are scheduled to be brought back in sync. + * * @see IResource#isSynchronized(int) */ public boolean isSynchronized(IResource target, int depth) { @@ -661,6 +663,8 @@ Policy.log(e); return false; } catch (IsSynchronizedVisitor.ResourceChangedException e) { + // Bring out-of-sync resources back into sync + workspace.getRefreshManager().refresh(e.target); //visitor throws an exception if out of sync return false; } @@ -718,16 +722,20 @@ public InputStream read(IFile target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); - if (!force) { - final IFileInfo fileInfo = store.fetchInfo(); - if (!fileInfo.exists()) { + final IFileInfo fileInfo = store.fetchInfo(); + if (!fileInfo.exists()) { + workspace.getRefreshManager().refresh(target); + if (!force) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.FAILED_READ_LOCAL, target.getFullPath(), message, null); } - ResourceInfo info = ((Resource) target).getResourceInfo(true, false); - int flags = ((Resource) target).getFlags(info); - ((Resource) target).checkExists(flags, true); - if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { + } + ResourceInfo info = ((Resource) target).getResourceInfo(true, false); + int flags = ((Resource) target).getFlags(info); + ((Resource) target).checkExists(flags, true); + if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { + workspace.getRefreshManager().refresh(target); + if (!force) { String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null); }