View | Details | Raw Unified | Return to bug 233939 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/internal/localstore/FileSystemResourceManager.java (-1 / +13 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Martin Oberhuber (Wind River) - [210664] descriptionChanged(): ignore LF style
10
 *     Martin Oberhuber (Wind River) - [210664] descriptionChanged(): ignore LF style
11
 *     Martin Oberhuber (Wind River) - [233939] findFilesForLocation() with symlinks
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.core.internal.localstore;
13
package org.eclipse.core.internal.localstore;
13
14
Lines 50-56 Link Here
50
	 * </p>
51
	 * </p>
51
	 */
52
	 */
52
	protected ArrayList allPathsForLocation(URI inputLocation) {
53
	protected ArrayList allPathsForLocation(URI inputLocation) {
53
		URI location = FileUtil.canonicalURI(inputLocation);
54
		URI canonicalLocation = FileUtil.canonicalURI(inputLocation);
55
		// First, try the canonical version of the inputLocation.
56
		// If the inputLocation is different from the canonical version, it will be tried second
57
		ArrayList results = allPathsForLocationNonCanonical(canonicalLocation);
58
		if(results.size()==0 && canonicalLocation!=inputLocation) {
59
			results = allPathsForLocationNonCanonical(inputLocation);
60
		}
61
		return results;
62
	}
63
	
64
	private ArrayList allPathsForLocationNonCanonical(URI inputLocation) {
65
		URI location = inputLocation;
54
		final boolean isFileLocation = EFS.SCHEME_FILE.equals(inputLocation.getScheme());
66
		final boolean isFileLocation = EFS.SCHEME_FILE.equals(inputLocation.getScheme());
55
		final IWorkspaceRoot root = getWorkspace().getRoot();
67
		final IWorkspaceRoot root = getWorkspace().getRoot();
56
		final ArrayList results = new ArrayList();
68
		final ArrayList results = new ArrayList();
(-)src/org/eclipse/core/tests/resources/regression/AllTests.java (-1 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 53-58 Link Here
53
		suite.addTest(Bug_165892.suite());
53
		suite.addTest(Bug_165892.suite());
54
		suite.addTest(Bug_226264.suite());
54
		suite.addTest(Bug_226264.suite());
55
		suite.addTest(Bug_231301.suite());
55
		suite.addTest(Bug_231301.suite());
56
		suite.addTest(Bug_233939.suite());
56
		suite.addTest(Bug_265810.suite());
57
		suite.addTest(Bug_265810.suite());
57
		suite.addTest(Bug_264182.suite());
58
		suite.addTest(Bug_264182.suite());
58
		suite.addTest(Bug_288315.suite());
59
		suite.addTest(Bug_288315.suite());
(-)src/org/eclipse/core/tests/resources/regression/Bug_233939.java (+89 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.core.tests.resources.regression;
12
13
import java.io.IOException;
14
import junit.framework.Test;
15
import junit.framework.TestSuite;
16
import org.eclipse.core.filesystem.EFS;
17
import org.eclipse.core.resources.*;
18
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IPath;
20
import org.eclipse.core.tests.resources.ResourceTest;
21
22
public class Bug_233939 extends ResourceTest {
23
	/**
24
	 * Constructor for Bug_233939.
25
	 */
26
	public Bug_233939() {
27
		super();
28
	}
29
30
	/**
31
	 * Constructor for Bug_233939.
32
	 * @param name
33
	 */
34
	public Bug_233939(String name) {
35
		super(name);
36
	}
37
38
	public static Test suite() {
39
		return new TestSuite(Bug_233939.class);
40
	}
41
42
	public void testBug() {
43
		// only activate this test on platforms that support it
44
		if (!isAttributeSupported(EFS.ATTRIBUTE_SYMLINK))
45
			return;
46
		String fileName = "file.txt";
47
48
		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
49
		IProject project = root.getProject(getUniqueString());
50
		IFile file = project.getFile(fileName);
51
52
		IPath fileInTempDirPath = getTempDir().addTrailingSeparator().append(fileName);
53
54
		// create a project
55
		try {
56
			project.create(getMonitor());
57
			project.open(getMonitor());
58
		} catch (CoreException e) {
59
			fail("1.0", e);
60
		}
61
62
		// create a file in the temp dir
63
		try {
64
			fileInTempDirPath.toFile().createNewFile();
65
		} catch (IOException e) {
66
			fail("2.0", e);
67
		}
68
69
		// create a link to the file in the temp dir and refresh,
70
		// the resource in the workspace should have symbolic link attribute set
71
		createSymLink(project.getLocation().toFile(), fileName, fileInTempDirPath.toString(), false);
72
		try {
73
			project.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
74
		} catch (CoreException e) {
75
			fail("3.0", e);
76
		}
77
		assertExistsInWorkspace("4.0", file);
78
		assertTrue("5.0", file.getResourceAttributes().isSymbolicLink());
79
80
		IFile[] files = root.findFilesForLocation(file.getLocation());
81
		assertEquals("7.0", 1, files.length);
82
		assertEquals("7.1", file, files[0]);
83
84
		//		IFile[] files = root.findFilesForLocation(fileInTempDirPath);
85
		//		assertEquals("6.0", 1, files.length);
86
		//		assertEquals("6.1", file, files[0]);
87
	}
88
89
}

Return to bug 233939