Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-03-15 16:18:00 +0000
committerKai Maetzel2004-03-15 16:18:00 +0000
commit5ac040f7c9adb002dedcd44e4643d4f65d5e315b (patch)
tree6393dccb31266c59a07b80da307b1a693b16ad5c /org.eclipse.core.filebuffers
parentf3e5048160ec9febe0c97c5c647c9b1ad0a9f9a4 (diff)
downloadeclipse.platform.text-5ac040f7c9adb002dedcd44e4643d4f65d5e315b.tar.gz
eclipse.platform.text-5ac040f7c9adb002dedcd44e4643d4f65d5e315b.tar.xz
eclipse.platform.text-5ac040f7c9adb002dedcd44e4643d4f65d5e315b.zip
#49235
Diffstat (limited to 'org.eclipse.core.filebuffers')
-rw-r--r--org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
index 14ea016ba..447f95e5d 100644
--- a/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
+++ b/org.eclipse.core.filebuffers/src/org/eclipse/core/filebuffers/FileBuffers.java
@@ -51,10 +51,13 @@ public final class FileBuffers {
*/
public static IFile getWorkspaceFileAtLocation(IPath location) {
IPath normalized= normalizeLocation(location);
- IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
- IFile file= workspaceRoot.getFile(normalized);
- if (file != null && file.exists())
- return file;
+ if (normalized.segmentCount() >= 2) {
+ // @see IContainer#getFile for the required number of segments
+ IWorkspaceRoot workspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
+ IFile file= workspaceRoot.getFile(normalized);
+ if (file != null && file.exists())
+ return file;
+ }
return null;
}

Back to the top