Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-11-21 15:17:57 +0000
committerDarin Wright2006-11-21 15:17:57 +0000
commit89fe9cc54da2d6cf255b4e7de136b8f2860a2d59 (patch)
treeee595d5836e8d6a634daf01b19027199dadb295b
parenta6cf7602c7dcaf1592f73da8f133541a63226da3 (diff)
downloadeclipse.platform.debug-89fe9cc54da2d6cf255b4e7de136b8f2860a2d59.tar.gz
eclipse.platform.debug-89fe9cc54da2d6cf255b4e7de136b8f2860a2d59.tar.xz
eclipse.platform.debug-89fe9cc54da2d6cf255b4e7de136b8f2860a2d59.zip
Bug 165175 [source lookup] ContainerSourceContainer assumes resource is in local file system
-rw-r--r--org.eclipse.debug.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java59
2 files changed, 30 insertions, 32 deletions
diff --git a/org.eclipse.debug.core/META-INF/MANIFEST.MF b/org.eclipse.debug.core/META-INF/MANIFEST.MF
index 120f387af..baaec6343 100644
--- a/org.eclipse.debug.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.core/META-INF/MANIFEST.MF
@@ -16,7 +16,8 @@ Export-Package: org.eclipse.debug.core,
org.eclipse.debug.internal.core.sourcelookup.containers;x-friends:="org.eclipse.debug.ui"
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)";visibility:=reexport,
org.eclipse.core.variables;bundle-version="[3.1.0,4.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)"
+ org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)",
+ org.eclipse.core.filesystem;bundle-version="[1.0.0,2.0.0)"
Eclipse-LazyStart: true
Import-Package: com.ibm.icu.text
Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
index aab06ff13..16a33089b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/sourcelookup/containers/ContainerSourceContainer.java
@@ -11,11 +11,12 @@
*******************************************************************************/
package org.eclipse.debug.core.sourcelookup.containers;
-import java.io.File;
-import java.io.IOException;
+import java.net.URI;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -46,8 +47,8 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
private IContainer fContainer = null;
private boolean fSubfolders = false;
- private IPath fRootPath = null;
- private File fRootFile = null;
+ private URI fRootURI = null;
+ private IFileStore fRootFile = null;
private IWorkspaceRoot fRoot = null;
/**
@@ -60,9 +61,12 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
public ContainerSourceContainer(IContainer container, boolean subfolders) {
fContainer = container;
fSubfolders = subfolders;
- fRootPath = fContainer.getLocation();
- if (fRootPath != null) {
- fRootFile = fRootPath.toFile();
+ fRootURI = fContainer.getLocationURI();
+ if (fRootURI != null) {
+ try {
+ fRootFile = EFS.getStore(fRootURI);
+ } catch (CoreException e) {
+ }
fRoot = ResourcesPlugin.getWorkspace().getRoot();
}
}
@@ -82,9 +86,6 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#findSourceElements(java.lang.String)
*/
public Object[] findSourceElements(String name) throws CoreException {
- if (fRootPath == null) {
- return EMPTY;
- }
ArrayList sources = new ArrayList();
// An IllegalArgumentException is thrown from the "getFile" method
@@ -97,27 +98,23 @@ public abstract class ContainerSourceContainer extends CompositeSourceContainer
if (file.exists()) {
sources.add(file);
} else {
- File osFile = new File(fRootFile, name);
- if (osFile.exists()) {
- try {
- // 1. See bug 82627 - case insensitive source lookup
-
- // 2. We no longer have to account for bug 95832, so we just create a path
- // on the OS canonical path (fix to bug 95679 was removed).
-
- // 3. See bug 98090 - we need to handle relative path names
-
- IPath workspacePath = new Path(osFile.getCanonicalPath());
- IFile[] files = fRoot.findFilesForLocation(workspacePath);
- if (isFindDuplicates() && files.length > 1) {
- for (int i = 0; i < files.length; i++) {
- sources.add(files[i]);
- }
- } else if (files.length > 0) {
- sources.add(files[0]);
- }
- } catch (IOException e) {
- }
+ // See bug 82627 - perform case insensitive source lookup
+ if (fRootURI == null) {
+ return EMPTY;
+ }
+ // See bug 98090 - we need to handle relative path names
+ IFileStore target = fRootFile.getChild(new Path(name));
+ if (target.fetchInfo().exists()) {
+ // We no longer have to account for bug 95832, and URIs take care
+ // of canonical paths (fix to bug 95679 was removed).
+ IFile[] files = fRoot.findFilesForLocationURI(target.toURI());
+ if (isFindDuplicates() && files.length > 1) {
+ for (int i = 0; i < files.length; i++) {
+ sources.add(files[i]);
+ }
+ } else if (files.length > 0) {
+ sources.add(files[0]);
+ }
}
}
}

Back to the top