Index: search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java,v retrieving revision 1.42 diff -u -r1.42 JavaSearchScope.java --- search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 14 Jun 2005 16:33:53 -0000 1.42 +++ search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 22 Jun 2005 13:28:35 -0000 @@ -306,7 +306,11 @@ for (int i = 0, length = this.paths.length; i < length; i++) { String scopePath = this.paths[i]; if (scopePath == null) continue; - if (encloses(this.containerPaths[i] + '/' + scopePath, relativePath, i)) + if (scopePath.length() == 0) + scopePath = this.containerPaths[i]; + else + scopePath = this.containerPaths[i] + '/' + scopePath; + if (encloses(scopePath, relativePath, i)) return i; } return -1; @@ -314,9 +318,21 @@ private boolean encloses(String scopePath, String path, int index) { if (this.pathWithSubFolders[index]) { - if (path.startsWith(scopePath)) { + // TODO (frederic) apply similar change also if not looking at subfolders + int pathLength = path.length(); + int scopeLength = scopePath.length(); + if (pathLength < scopeLength) { + return false; + } + if (scopeLength == 0) { return true; } + if (pathLength == scopeLength) { + return path.equals(scopePath); + } + if (path.startsWith(scopePath)) { + return path.charAt(scopeLength) == '/'; + } } else { // if not looking at subfolders, this scope encloses the given path // if this path is a direct child of the scope's ressource