### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v retrieving revision 1.160 diff -u -r1.160 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 4 Apr 2007 16:27:28 -0000 1.160 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 13 Apr 2007 09:54:32 -0000 @@ -261,7 +261,7 @@ */ p1.close(); JavaModelManager.PerProjectInfo perProjectInfo = JavaModelManager.getJavaModelManager().getPerProjectInfo(p1.getProject(), true/*create if missing*/); - perProjectInfo.setClasspath(null, null, null, null, null, null); + perProjectInfo.setClasspath(null, null, null, null, null, null, null); // shouldn't fail p1.getExpandedClasspath(); #P org.eclipse.jdt.core Index: model/org/eclipse/jdt/internal/core/util/HandleFactory.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java,v retrieving revision 1.40 diff -u -r1.40 HandleFactory.java --- model/org/eclipse/jdt/internal/core/util/HandleFactory.java 13 Jun 2006 13:00:44 -0000 1.40 +++ model/org/eclipse/jdt/internal/core/util/HandleFactory.java 13 Apr 2007 09:54:36 -0000 @@ -258,13 +258,10 @@ // is NOT on the classpath of org.eclipse.swt.win32 IFile jarFile = (IFile)target; JavaProject javaProject = (JavaProject) this.javaModel.getJavaProject(jarFile); - IClasspathEntry[] classpathEntries; try { - classpathEntries = javaProject.getResolvedClasspath(); - for (int j= 0, entryCount= classpathEntries.length; j < entryCount; j++) { - if (classpathEntries[j].getPath().equals(jarPath)) { - return javaProject.getPackageFragmentRoot(jarFile); - } + IClasspathEntry entry = javaProject.getClasspathEntryFor(jarPath); + if (entry != null) { + return javaProject.getPackageFragmentRoot(jarFile); } } catch (JavaModelException e) { // ignore and try to find another project @@ -310,16 +307,14 @@ for (int i= 0, projectCount= projects.length; i < projectCount; i++) { try { JavaProject javaProject= (JavaProject)projects[i]; - IClasspathEntry[] classpathEntries= javaProject.getResolvedClasspath(); - for (int j= 0, entryCount= classpathEntries.length; j < entryCount; j++) { - if (classpathEntries[j].getPath().equals(jarPath)) { - if (target instanceof IFile) { - // internal jar - return javaProject.getPackageFragmentRoot((IFile)target); - } else { - // external jar - return javaProject.getPackageFragmentRoot0(jarPath); - } + IClasspathEntry classpathEnty = javaProject.getClasspathEntryFor(jarPath); + if (classpathEnty != null) { + if (target instanceof IFile) { + // internal jar + return javaProject.getPackageFragmentRoot((IFile)target); + } else { + // external jar + return javaProject.getPackageFragmentRoot0(jarPath); } } } catch (JavaModelException e) { Index: model/org/eclipse/jdt/internal/core/ExternalJavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalJavaProject.java,v retrieving revision 1.3 diff -u -r1.3 ExternalJavaProject.java --- model/org/eclipse/jdt/internal/core/ExternalJavaProject.java 13 Jun 2006 13:00:43 -0000 1.3 +++ model/org/eclipse/jdt/internal/core/ExternalJavaProject.java 13 Apr 2007 09:54:33 -0000 @@ -27,7 +27,7 @@ public ExternalJavaProject(IClasspathEntry[] rawClasspath) { super(ResourcesPlugin.getWorkspace().getRoot().getProject(EXTERNAL_PROJECT_NAME), JavaModelManager.getJavaModelManager().getJavaModel()); try { - getPerProjectInfo().setClasspath(rawClasspath, defaultOutputLocation(), JavaModelStatus.VERIFIED_OK/*no .classpath format problem*/, null/*no resolved claspath*/, null/*no reverse map*/, null/*no resolved status*/); + getPerProjectInfo().setClasspath(rawClasspath, defaultOutputLocation(), JavaModelStatus.VERIFIED_OK/*no .classpath format problem*/, null/*no resolved claspath*/, null/*no reverse map*/, null/*no path to entry map*/, null/*no resolved status*/); } catch (JavaModelException e) { // getPerProjectInfo() never throws JavaModelException for an ExternalJavaProject } Index: model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java,v retrieving revision 1.122 diff -u -r1.122 PackageFragmentRoot.java --- model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java 16 Mar 2007 18:28:58 -0000 1.122 +++ model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java 13 Apr 2007 09:54:35 -0000 @@ -38,11 +38,6 @@ * attachment server property. */ protected final static char ATTACHMENT_PROPERTY_DELIMITER= '*'; - /* - * No source attachment property - */ - protected final static String NO_SOURCE_ATTACHMENT = ""; //$NON-NLS-1$ - /** * The resource associated with this root. * (an IResource or a java.io.File (for external jar only)) @@ -316,12 +311,9 @@ * not exist. */ protected int determineKind(IResource underlyingResource) throws JavaModelException { - IClasspathEntry[] entries= ((JavaProject)getJavaProject()).getResolvedClasspath(); - for (int i= 0; i < entries.length; i++) { - IClasspathEntry entry= entries[i]; - if (entry.getPath().equals(underlyingResource.getFullPath())) { - return entry.getContentKind(); - } + IClasspathEntry entry = ((JavaProject)getJavaProject()).getClasspathEntryFor(underlyingResource.getFullPath()); + if (entry != null) { + return entry.getContentKind(); } return IPackageFragmentRoot.K_SOURCE; } @@ -349,7 +341,7 @@ return super.exists() && validateOnClasspath().isOK(); } -public IClasspathEntry findSourceAttachmentRecommendation() { +private IClasspathEntry findSourceAttachmentRecommendation() { try { IPath rootPath = this.getPath(); IClasspathEntry entry; @@ -607,52 +599,44 @@ public IPath getSourceAttachmentPath() throws JavaModelException { if (getKind() != K_BINARY) return null; + // 1) look source attachment property (set iff attachSource(...) was called String serverPathString= getSourceAttachmentProperty(); - if (serverPathString == null) { - return null; + if (serverPathString != null) { + int index= serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER); + if (index < 0) { + // no root path specified + return new Path(serverPathString); + } else { + String serverSourcePathString= serverPathString.substring(0, index); + return new Path(serverSourcePathString); + } } - int index= serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER); - if (index < 0) { - // no root path specified - return new Path(serverPathString); - } else { - String serverSourcePathString= serverPathString.substring(0, index); - return new Path(serverSourcePathString); + + // 2) look at classpath entry + IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); + IPath sourceAttachmentPath; + if (entry != null && (sourceAttachmentPath = entry.getSourceAttachmentPath()) != null) + return sourceAttachmentPath; + + // 3) look for a recommendation + entry = findSourceAttachmentRecommendation(); + if (entry != null && (sourceAttachmentPath = entry.getSourceAttachmentPath()) != null) { + return sourceAttachmentPath; } + + return null; } /** * Returns the server property for this package fragment root's * source attachement. */ -protected String getSourceAttachmentProperty() throws JavaModelException { - String propertyString = null; - QualifiedName qName= getSourceAttachmentPropertyName(); +private String getSourceAttachmentProperty() throws JavaModelException { try { - propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); - - // if no existing source attachment information, then lookup a recommendation from classpath entries - if (propertyString == null) { - IClasspathEntry recommendation = findSourceAttachmentRecommendation(); - if (recommendation != null) { - IPath rootPath = recommendation.getSourceAttachmentRootPath(); - propertyString = - recommendation.getSourceAttachmentPath().toString() - + ((rootPath == null) - ? "" : //$NON-NLS-1$ - (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString())); - setSourceAttachmentProperty(propertyString); - } else { - // mark as being already looked up - setSourceAttachmentProperty(NO_SOURCE_ATTACHMENT); - } - } else if (NO_SOURCE_ATTACHMENT.equals(propertyString)) { - // already looked up and no source attachment found - return null; - } - return propertyString; - } catch (CoreException ce) { - throw new JavaModelException(ce); + QualifiedName qName= getSourceAttachmentPropertyName(); + return ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); + } catch (CoreException e) { + throw new JavaModelException(e); } } @@ -660,7 +644,7 @@ * Returns the qualified name for the source attachment property * of this root. */ -protected QualifiedName getSourceAttachmentPropertyName() { +private QualifiedName getSourceAttachmentPropertyName() { return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ } @@ -688,17 +672,30 @@ public IPath getSourceAttachmentRootPath() throws JavaModelException { if (getKind() != K_BINARY) return null; + // 1) look source attachment property (set iff attachSource(...) was called String serverPathString= getSourceAttachmentProperty(); - if (serverPathString == null) { - return null; - } - int index = serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER); - if (index == -1) return null; - String serverRootPathString= IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH; - if (index != serverPathString.length() - 1) { - serverRootPathString= serverPathString.substring(index + 1); + if (serverPathString != null) { + int index = serverPathString.lastIndexOf(ATTACHMENT_PROPERTY_DELIMITER); + if (index == -1) return null; + String serverRootPathString= IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH; + if (index != serverPathString.length() - 1) { + serverRootPathString= serverPathString.substring(index + 1); + } + return new Path(serverRootPathString); } - return new Path(serverRootPathString); + + // 2) look at classpath entry + IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); + IPath sourceAttachmentRootPath; + if (entry != null && (sourceAttachmentRootPath = entry.getSourceAttachmentRootPath()) != null) + return sourceAttachmentRootPath; + + // 3) look for a recomendation + entry = findSourceAttachmentRecommendation(); + if (entry != null && (sourceAttachmentRootPath = entry.getSourceAttachmentRootPath()) != null) + return sourceAttachmentRootPath; + + return null; } /** @@ -717,17 +714,6 @@ mapper = createSourceMapper(getPath(), rootPath); // attach root to itself else mapper = createSourceMapper(sourcePath, rootPath); - if (rootPath == null && mapper.rootPath != null) { - // as a side effect of calling the SourceMapper constructor, the root path was computed - rootPath = new Path(mapper.rootPath); - - //set the property to the path of the mapped source - if (sourcePath != null) - setSourceAttachmentProperty( - sourcePath.toString() - + ATTACHMENT_PROPERTY_DELIMITER - + rootPath.toString()); - } rootInfo.setSourceMapper(mapper); } } catch (JavaModelException e) { @@ -780,12 +766,9 @@ try { // check package fragment root on classpath of its project JavaProject project = (JavaProject) getJavaProject(); - IClasspathEntry[] classpath = project.getResolvedClasspath(); - for (int i = 0, length = classpath.length; i < length; i++) { - IClasspathEntry entry = classpath[i]; - if (entry.getPath().equals(path)) { - return Status.OK_STATUS; - } + IClasspathEntry entry = project.getClasspathEntryFor(path); + if (entry != null) { + return Status.OK_STATUS; } } catch(JavaModelException e){ // could not read classpath, then assume it is outside Index: model/org/eclipse/jdt/internal/core/JavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v retrieving revision 1.386 diff -u -r1.386 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 30 Mar 2007 12:38:03 -0000 1.386 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 13 Apr 2007 09:54:35 -0000 @@ -402,20 +402,6 @@ return true; } - protected void closing(Object info) { - - // forget source attachment recommendations - Object[] children = ((JavaElementInfo)info).children; - for (int i = 0, length = children.length; i < length; i++) { - Object child = children[i]; - if (child instanceof JarPackageFragmentRoot){ - ((JarPackageFragmentRoot)child).setSourceAttachmentProperty(null); - } - } - - super.closing(info); - } - /** * Computes the collection of package fragment roots (local ones) and set it on the given info. * Need to check *all* package fragment roots in order to reset NameLookup @@ -1354,16 +1340,15 @@ * @return IClasspathEntry * @throws JavaModelException */ - public IClasspathEntry getClasspathEntryFor(IPath path) - throws JavaModelException { - - IClasspathEntry[] entries = getExpandedClasspath(); - for (int i = 0; i < entries.length; i++) { - if (entries[i].getPath().equals(path)) { - return entries[i]; - } - } - return null; + public IClasspathEntry getClasspathEntryFor(IPath path) throws JavaModelException { + getResolvedClasspath(); // force resolution + PerProjectInfo perProjectInfo = getPerProjectInfo(); + if (perProjectInfo == null) + return null; + Map pathToResolvedEntry = perProjectInfo.pathToResolvedEntry; + if (pathToResolvedEntry == null) + return null; + return (IClasspathEntry) pathToResolvedEntry.get(path); } /* @@ -2554,6 +2539,7 @@ HashMap rawReverseMap = new HashMap(); ArrayList resolvedEntries = new ArrayList(); + Map pathToResolvedEntry = new HashMap(); int length = rawClasspath.length; for (int i = 0; i < length; i++) { @@ -2579,6 +2565,7 @@ if (rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); } resolvedEntries.add(resolvedEntry); + pathToResolvedEntry.put(resolvedEntry.getPath(), resolvedEntry); } break; @@ -2607,6 +2594,7 @@ if (rawReverseMap.get(resolvedPath = cEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); } resolvedEntries.add(cEntry); + pathToResolvedEntry.put(cEntry.getPath(), cEntry); } break; @@ -2615,13 +2603,15 @@ if (rawReverseMap.get(resolvedPath = rawEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); } resolvedEntries.add(rawEntry); + pathToResolvedEntry.put(rawEntry.getPath(), rawEntry); + } } // store resolved info along with the raw info to ensure consistency IClasspathEntry[] resolvedClasspath = new IClasspathEntry[resolvedEntries.size()]; resolvedEntries.toArray(resolvedClasspath); - perProjectInfo.setClasspath(rawClasspath, outputLocation, rawClasspathStatus, resolvedClasspath, rawReverseMap, unresolvedEntryStatus); + perProjectInfo.setClasspath(rawClasspath, outputLocation, rawClasspathStatus, resolvedClasspath, rawReverseMap, pathToResolvedEntry, unresolvedEntryStatus); } finally { manager.setClasspathBeingResolved(this, false); } Index: model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java,v retrieving revision 1.43 diff -u -r1.43 JavaProjectElementInfo.java --- model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java 10 Nov 2006 17:09:31 -0000 1.43 +++ model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java 13 Apr 2007 09:54:35 -0000 @@ -100,19 +100,14 @@ boolean binIsProject = false; char[][] inclusionPatterns = null; char[][] exclusionPatterns = null; - IClasspathEntry[] classpath = null; IPath projectOutput = null; boolean isClasspathResolved = true; try { - classpath = project.getResolvedClasspath(); - for (int i = 0; i < classpath.length; i++) { - IClasspathEntry entry = classpath[i]; - if (projectPath.equals(entry.getPath())) { - srcIsProject = true; - inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars(); - exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars(); - break; - } + IClasspathEntry entry = project.getClasspathEntryFor(projectPath); + if (entry != null) { + srcIsProject = true; + inclusionPatterns = ((ClasspathEntry)entry).fullInclusionPatternChars(); + exclusionPatterns = ((ClasspathEntry)entry).fullExclusionPatternChars(); } projectOutput = project.getOutputLocation(); binIsProject = projectPath.equals(projectOutput); @@ -128,6 +123,7 @@ if (length > 0) { String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true); String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true); + IClasspathEntry[] classpath = project.getResolvedClasspath(); for (int i = 0; i < length; i++) { IResource res = members[i]; switch (res.getType()) { Index: model/org/eclipse/jdt/internal/core/SetClasspathOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java,v retrieving revision 1.150 diff -u -r1.150 SetClasspathOperation.java --- model/org/eclipse/jdt/internal/core/SetClasspathOperation.java 16 Mar 2007 18:28:58 -0000 1.150 +++ model/org/eclipse/jdt/internal/core/SetClasspathOperation.java 13 Apr 2007 09:54:36 -0000 @@ -50,7 +50,7 @@ checkCanceled(); try { // set raw classpath and null out resolved info - this.project.getPerProjectInfo().setClasspath(this.newRawClasspath, this.newOutputLocation, JavaModelStatus.VERIFIED_OK/*format is ok*/, null, null, null); + this.project.getPerProjectInfo().setClasspath(this.newRawClasspath, this.newOutputLocation, JavaModelStatus.VERIFIED_OK/*format is ok*/, null, null, null, null); // if needed, generate delta, update project ref, create markers, ... classpathChanged(this.project); Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v retrieving revision 1.367 diff -u -r1.367 JavaModelManager.java --- model/org/eclipse/jdt/internal/core/JavaModelManager.java 30 Mar 2007 12:38:03 -0000 1.367 +++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 13 Apr 2007 09:54:34 -0000 @@ -862,13 +862,9 @@ // Create a jar package fragment root only if on the classpath IPath resourcePath = file.getFullPath(); try { - IClasspathEntry[] entries = ((JavaProject)project).getResolvedClasspath(); - for (int i = 0, length = entries.length; i < length; i++) { - IClasspathEntry entry = entries[i]; - IPath rootPath = entry.getPath(); - if (rootPath.equals(resourcePath)) { - return project.getPackageFragmentRoot(file); - } + IClasspathEntry entry = ((JavaProject)project).getClasspathEntryFor(resourcePath); + if (entry != null) { + return project.getPackageFragmentRoot(file); } } catch (JavaModelException e) { // project doesn't exist: return null @@ -985,6 +981,7 @@ public IClasspathEntry[] resolvedClasspath; public IJavaModelStatus unresolvedEntryStatus; public Map resolvedPathToRawEntries; // reverse map from resolved path to raw entries + public Map pathToResolvedEntry; // map from an entry's path to the entry public IPath outputLocation; public IEclipsePreferences preferences; @@ -1022,10 +1019,10 @@ public synchronized void resetResolvedClasspath() { // null out resolved information - setClasspath(this.rawClasspath, this.outputLocation, this.rawClasspathStatus, null, null, null); + setClasspath(this.rawClasspath, this.outputLocation, this.rawClasspathStatus, null, null, null, null); } - public synchronized void setClasspath(IClasspathEntry[] newRawClasspath, IPath newOutputLocation, IJavaModelStatus newRawClasspathStatus, IClasspathEntry[] newResolvedClasspath, Map newResolvedPathToRawEntries, IJavaModelStatus newUnresolvedEntryStatus) { + public synchronized void setClasspath(IClasspathEntry[] newRawClasspath, IPath newOutputLocation, IJavaModelStatus newRawClasspathStatus, IClasspathEntry[] newResolvedClasspath, Map newResolvedPathToRawEntries, Map newPathToResolvedEntry, IJavaModelStatus newUnresolvedEntryStatus) { // remember old info JavaModelManager manager = JavaModelManager.getJavaModelManager(); DeltaProcessor deltaProcessor = manager.deltaState.getDeltaProcessor(); @@ -1036,6 +1033,7 @@ this.rawClasspathStatus = newRawClasspathStatus; this.resolvedClasspath = newResolvedClasspath; this.resolvedPathToRawEntries = newResolvedPathToRawEntries; + this.pathToResolvedEntry = newPathToResolvedEntry; this.unresolvedEntryStatus = newUnresolvedEntryStatus; this.javadocCache = new LRUCache(JAVADOC_CACHE_INITIAL_SIZE); } @@ -1090,7 +1088,7 @@ } // store new raw classpath, new output and new status, and null out resolved info - setClasspath(classpath, output, status, null, null, null); + setClasspath(classpath, output, status, null, null, null, null); return classpath; } Index: model/org/eclipse/jdt/internal/core/ClasspathChange.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java,v retrieving revision 1.5 diff -u -r1.5 ClasspathChange.java --- model/org/eclipse/jdt/internal/core/ClasspathChange.java 6 Mar 2007 02:38:49 -0000 1.5 +++ model/org/eclipse/jdt/internal/core/ClasspathChange.java 13 Apr 2007 09:54:33 -0000 @@ -61,8 +61,6 @@ } catch (JavaModelException e) { // ignore } - // force detach source on jar package fragment roots (source will be lazily computed when needed) - ((PackageFragmentRoot) root).setSourceAttachmentProperty(null);// loose info - will be recomputed } } } @@ -335,7 +333,6 @@ } catch (JavaModelException e) { // ignore } - ((PackageFragmentRoot) root).setSourceAttachmentProperty(null);// loose info - will be recomputed } } } Index: model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java,v retrieving revision 1.99 diff -u -r1.99 TypeHierarchy.java --- model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 16 Mar 2007 18:28:59 -0000 1.99 +++ model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java 13 Apr 2007 09:54:36 -0000 @@ -930,12 +930,9 @@ for (int i = 0; i < elements.length; i++) { JavaProject javaProject = (JavaProject)elements[i]; try { - IClasspathEntry[] classpath = javaProject.getResolvedClasspath(); - for (int j = 0; j < classpath.length; j++) { - IClasspathEntry entry = classpath[j]; - if (entry.getPath().equals(rootPath)) { - return true; - } + IClasspathEntry entry = javaProject.getClasspathEntryFor(rootPath); + if (entry != null) { + return true; } } catch (JavaModelException e) { // igmore this project Index: search/org/eclipse/jdt/internal/core/search/IndexSelector.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java,v retrieving revision 1.36 diff -u -r1.36 IndexSelector.java --- search/org/eclipse/jdt/internal/core/search/IndexSelector.java 25 Jan 2007 16:05:56 -0000 1.36 +++ search/org/eclipse/jdt/internal/core/search/IndexSelector.java 13 Apr 2007 09:54:36 -0000 @@ -64,13 +64,11 @@ IJavaProject[] allProjects = model.getJavaProjects(); for (int i = 0, length = allProjects.length; i < length; i++) { JavaProject otherProject = (JavaProject) allProjects[i]; - IClasspathEntry[] entries = otherProject.getResolvedClasspath(); - for (int j = 0, length2 = entries.length; j < length2; j++) { - IClasspathEntry entry = entries[j]; - if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath().equals(projectOrJarPath)) - if (canSeeFocus(focus, otherProject, focusEntries)) - return true; - } + IClasspathEntry entry = otherProject.getClasspathEntryFor(projectOrJarPath); + if (entry != null + && entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY + && canSeeFocus(focus, otherProject, focusEntries)) + return true; } return false; } catch (JavaModelException e) { Index: search/org/eclipse/jdt/internal/core/search/HierarchyScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java,v retrieving revision 1.40 diff -u -r1.40 HierarchyScope.java --- search/org/eclipse/jdt/internal/core/search/HierarchyScope.java 13 Jun 2006 13:00:43 -0000 1.40 +++ search/org/eclipse/jdt/internal/core/search/HierarchyScope.java 13 Apr 2007 09:54:36 -0000 @@ -162,22 +162,19 @@ HashSet visited = new HashSet(); for (int i = 0; i < projects.length; i++) { JavaProject project = (JavaProject) projects[i]; - IClasspathEntry[] classpath = project.getResolvedClasspath(); - for (int j = 0; j < classpath.length; j++) { - if (rootPath.equals(classpath[j].getPath())) { - // add the project and its binary pkg fragment roots - IPackageFragmentRoot[] roots = project.getAllPackageFragmentRoots(); - set.add(project.getPath()); - for (int k = 0; k < roots.length; k++) { - IPackageFragmentRoot pkgFragmentRoot = roots[k]; - if (pkgFragmentRoot.getKind() == IPackageFragmentRoot.K_BINARY) { - set.add(pkgFragmentRoot.getPath()); - } + IClasspathEntry entry = project.getClasspathEntryFor(rootPath); + if (entry != null) { + // add the project and its binary pkg fragment roots + IPackageFragmentRoot[] roots = project.getAllPackageFragmentRoots(); + set.add(project.getPath()); + for (int k = 0; k < roots.length; k++) { + IPackageFragmentRoot pkgFragmentRoot = roots[k]; + if (pkgFragmentRoot.getKind() == IPackageFragmentRoot.K_BINARY) { + set.add(pkgFragmentRoot.getPath()); } - // add the dependent projects - this.computeDependents(project, set, visited); - break; } + // add the dependent projects + this.computeDependents(project, set, visited); } } } else {