diff options
author | Szymon Ptaszkiewicz | 2014-02-28 14:49:01 +0000 |
---|---|---|
committer | Szymon Ptaszkiewicz | 2014-02-28 14:49:01 +0000 |
commit | 8a159d9afc1b7b982c072437a569730d24658c97 (patch) | |
tree | 6d3b85b691f9c309df900620214a0188e74b6cb8 | |
parent | 903632ff3bab75af1845d36d0f350429875820e2 (diff) | |
download | eclipse.platform.resources-8a159d9afc1b7b982c072437a569730d24658c97.tar.gz eclipse.platform.resources-8a159d9afc1b7b982c072437a569730d24658c97.tar.xz eclipse.platform.resources-8a159d9afc1b7b982c072437a569730d24658c97.zip |
Bug 368376 - isSynchronized ignores subfolders created automatically when refreshing a fileI20140303-0800I20140302-2000
2 files changed, 35 insertions, 3 deletions
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java index 1390c638b..15921f5fa 100644 --- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java +++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/UnifiedTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -280,7 +280,7 @@ public class UnifiedTree { IPath childPath = parent.getResource().getFullPath().append(info.getName()); int type = info.isDirectory() ? IResource.FOLDER : IResource.FILE; IResource target = getWorkspace().newResource(childPath, type); - return createNode(target, null, info, false); + return createNode(target, null, info, target.exists()); } /** diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/UnifiedTreeTest.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/UnifiedTreeTest.java index 8122499bc..8a5e22444 100644 --- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/UnifiedTreeTest.java +++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/internal/localstore/UnifiedTreeTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ import org.eclipse.core.internal.resources.Resource; import org.eclipse.core.internal.resources.Workspace; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.preferences.*; /** * @@ -280,4 +281,35 @@ public class UnifiedTreeTest extends LocalStoreTest { assertTrue("2.0", rf.exists()); } + + public void testBug368376() throws CoreException, IOException { + IEclipsePreferences instanceNode = InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES); + assertFalse(instanceNode.getBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, false)); + assertFalse(instanceNode.getBoolean(ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false)); + + IEclipsePreferences defaultNode = DefaultScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES); + assertFalse(defaultNode.getBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, false)); + assertFalse(defaultNode.getBoolean(ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, false)); + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getUniqueString()); + ensureExistsInWorkspace(project, true); + + String filePath = "a/b/c/file.txt"; + File javaFile = new File(project.getLocation().toFile(), filePath); + assertTrue(javaFile.getParentFile().mkdirs()); + assertTrue(javaFile.createNewFile()); + + IFolder folder = project.getFolder("a"); + IFile file = project.getFile(filePath); + assertFalse(folder.exists()); + assertFalse(file.exists()); + + file.refreshLocal(IResource.DEPTH_INFINITE, getMonitor()); + + assertTrue(folder.exists()); + assertTrue(file.exists()); + assertTrue(folder.isSynchronized(IResource.DEPTH_INFINITE)); + + project.delete(true, getMonitor()); + } } |