Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63741 Details for
Bug 145329
[scaling] Unable to locate source in monster workspace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
145329.txt (text/plain), 35.97 KB, created by
Jerome Lanneluc
on 2007-04-13 09:43:23 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-04-13 09:43:23 EDT
Size:
35.97 KB
patch
obsolete
>### 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 13:43:50 -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 13:43:54 -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/util/Util.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v >retrieving revision 1.105 >diff -u -r1.105 Util.java >--- model/org/eclipse/jdt/internal/core/util/Util.java 6 Mar 2007 02:38:49 -0000 1.105 >+++ model/org/eclipse/jdt/internal/core/util/Util.java 13 Apr 2007 13:43:55 -0000 >@@ -1081,6 +1081,43 @@ > } > > /* >+ * Returns the source attachment property for this package fragment root's path >+ */ >+ public static String getSourceAttachmentProperty(IPath path) throws JavaModelException { >+ Map rootPathToAttachments = JavaModelManager.getJavaModelManager().rootPathToAttachments; >+ String property = (String) rootPathToAttachments.get(path); >+ if (property == null) { >+ try { >+ property = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(getSourceAttachmentPropertyName(path)); >+ if (property == null) { >+ rootPathToAttachments.put(path, PackageFragmentRoot.NO_SOURCE_ATTACHMENT); >+ return null; >+ } >+ rootPathToAttachments.put(path, property); >+ return property; >+ } catch (CoreException e) { >+ throw new JavaModelException(e); >+ } >+ } else if (property.equals(PackageFragmentRoot.NO_SOURCE_ATTACHMENT)) { >+ return null; >+ } else >+ return property; >+ } >+ >+ private static QualifiedName getSourceAttachmentPropertyName(IPath path) { >+ return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$ >+ } >+ >+ public static void setSourceAttachmentProperty(IPath path, String property) { >+ JavaModelManager.getJavaModelManager().rootPathToAttachments.put(path, property); >+ try { >+ ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(getSourceAttachmentPropertyName(path), property); >+ } catch (CoreException e) { >+ e.printStackTrace(); >+ } >+ } >+ >+ /* > * Returns the declaring type signature of the element represented by the given binding key. > * Returns the signature of the element if it is a type. > * >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 13:43:52 -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 resolve entry map*/, null/*no resolved status*/); > } catch (JavaModelException e) { > // getPerProjectInfo() never throws JavaModelException for an ExternalJavaProject > } >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 13:43:54 -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/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 13:43:54 -0000 >@@ -15,13 +15,7 @@ > import java.util.Map; > > import org.eclipse.core.resources.*; >-import org.eclipse.core.resources.IContainer; >-import org.eclipse.core.resources.IFolder; >-import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.*; >-import org.eclipse.core.runtime.CoreException; >-import org.eclipse.core.runtime.IPath; >-import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.CharOperation; > import org.eclipse.jdt.internal.core.util.MementoTokenizer; >@@ -41,7 +35,7 @@ > /* > * No source attachment property > */ >- protected final static String NO_SOURCE_ATTACHMENT = ""; //$NON-NLS-1$ >+ public final static String NO_SOURCE_ATTACHMENT = ""; //$NON-NLS-1$ > > /** > * The resource associated with this root. >@@ -119,10 +113,11 @@ > setSourceMapper(mapper); > } > if (sourcePath == null) { >- setSourceAttachmentProperty(null); //remove the property >+ Util.setSourceAttachmentProperty(getPath(), null); //remove the property > } else { > //set the property to the path of the mapped source >- setSourceAttachmentProperty( >+ Util.setSourceAttachmentProperty( >+ getPath(), > sourcePath.toString() > + (rootPath == null ? "" : (ATTACHMENT_PROPERTY_DELIMITER + rootPath.toString()))); //$NON-NLS-1$ > } >@@ -144,7 +139,7 @@ > } > } > } catch (JavaModelException e) { >- setSourceAttachmentProperty(null); // loose info - will be recomputed >+ Util.setSourceAttachmentProperty(getPath(), null); // loose info - will be recomputed > throw e; > } finally { > if (monitor != null) { >@@ -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; >@@ -587,9 +579,9 @@ > IClasspathEntry rawEntry = null; > JavaProject project = (JavaProject)this.getJavaProject(); > project.getResolvedClasspath(); // force the reverse rawEntry cache to be populated >- Map resolvedPathToRawEntries = project.getPerProjectInfo().resolvedPathToRawEntries; >- if (resolvedPathToRawEntries != null) { >- rawEntry = (IClasspathEntry) resolvedPathToRawEntries.get(this.getPath()); >+ Map rootPathToRawEntries = project.getPerProjectInfo().rootPathToRawEntries; >+ if (rootPathToRawEntries != null) { >+ rawEntry = (IClasspathEntry) rootPathToRawEntries.get(this.getPath()); > } > return rawEntry; > } >@@ -607,69 +599,33 @@ > public IPath getSourceAttachmentPath() throws JavaModelException { > if (getKind() != K_BINARY) return null; > >- String serverPathString= getSourceAttachmentProperty(); >- if (serverPathString == null) { >- return 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); >- } >-} >- >-/** >- * Returns the server property for this package fragment root's >- * source attachement. >- */ >-protected String getSourceAttachmentProperty() throws JavaModelException { >- String propertyString = null; >- QualifiedName qName= getSourceAttachmentPropertyName(); >- 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; >+ // 1) look source attachment property (set iff attachSource(...) was called >+ IPath path = getPath(); >+ String serverPathString= Util.getSourceAttachmentProperty(path); >+ 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); > } >- return propertyString; >- } catch (CoreException ce) { >- throw new JavaModelException(ce); > } >-} >- >-/** >- * Returns the qualified name for the source attachment property >- * of this root. >- */ >-protected QualifiedName getSourceAttachmentPropertyName() { >- return new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + this.getPath().toOSString()); //$NON-NLS-1$ >-} > >-public void setSourceAttachmentProperty(String property) { >- try { >- ResourcesPlugin.getWorkspace().getRoot().setPersistentProperty(this.getSourceAttachmentPropertyName(), property); >- } catch (CoreException ce) { >- // ignore >+ // 2) look at classpath entry >+ IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(path); >+ 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; > } > > /** >@@ -688,17 +644,31 @@ > public IPath getSourceAttachmentRootPath() throws JavaModelException { > if (getKind() != K_BINARY) return null; > >- 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); >- } >- return new Path(serverRootPathString); >+ // 1) look source attachment property (set iff attachSource(...) was called >+ IPath path = getPath(); >+ String serverPathString= Util.getSourceAttachmentProperty(path); >+ 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); >+ } >+ >+ // 2) look at classpath entry >+ IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(path); >+ 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 +687,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 +739,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 13:43:53 -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 rootPathToResolvedEntries = perProjectInfo.rootPathToResolvedEntries; >+ if (rootPathToResolvedEntries == null) >+ return null; >+ return (IClasspathEntry) rootPathToResolvedEntries.get(path); > } > > /* >@@ -2552,6 +2537,7 @@ > > IJavaModelStatus unresolvedEntryStatus = JavaModelStatus.VERIFIED_OK; > HashMap rawReverseMap = new HashMap(); >+ Map rootPathToResolvedEntries = new HashMap(); > > ArrayList resolvedEntries = new ArrayList(); > int length = rawClasspath.length; >@@ -2575,8 +2561,9 @@ > if (resolvedEntry == null) { > unresolvedEntryStatus = new JavaModelStatus(IJavaModelStatusConstants.CP_VARIABLE_PATH_UNBOUND, this, rawEntry.getPath()); > } else { >- if (rawReverseMap != null) { >- if (rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); >+ if (rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) { >+ rawReverseMap.put(resolvedPath , rawEntry); >+ rootPathToResolvedEntries.put(resolvedPath, resolvedEntry); > } > resolvedEntries.add(resolvedEntry); > } >@@ -2603,25 +2590,28 @@ > } > // if container is exported or restricted, then its nested entries must in turn be exported (21749) and/or propagate restrictions > cEntry = cEntry.combineWith((ClasspathEntry) rawEntry); >- if (rawReverseMap != null) { >- if (rawReverseMap.get(resolvedPath = cEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); >+ if (rawReverseMap.get(resolvedPath = cEntry.getPath()) == null) { >+ rawReverseMap.put(resolvedPath , rawEntry); >+ rootPathToResolvedEntries.put(resolvedPath, cEntry); > } > resolvedEntries.add(cEntry); > } > break; > > default : >- if (rawReverseMap != null) { >- if (rawReverseMap.get(resolvedPath = rawEntry.getPath()) == null) rawReverseMap.put(resolvedPath , rawEntry); >+ if (rawReverseMap.get(resolvedPath = rawEntry.getPath()) == null) { >+ rawReverseMap.put(resolvedPath , rawEntry); >+ rootPathToResolvedEntries.put(resolvedPath, rawEntry); > } > resolvedEntries.add(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, rootPathToResolvedEntries, 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 13:43:53 -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/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 13:43:53 -0000 >@@ -123,6 +123,11 @@ > * Extension used to construct Java 6 annotation processor managers > */ > private IConfigurationElement annotationProcessorManagerFactory = null; >+ >+ /* >+ * Map from a package fragment root's path to a source attachment property (source path + ATTACHMENT_PROPERTY_DELIMITER + source root path) >+ */ >+ public Map rootPathToAttachments = new HashMap(); > > public final static String CP_VARIABLE_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathVariable."; //$NON-NLS-1$ > public final static String CP_CONTAINER_PREFERENCES_PREFIX = JavaCore.PLUGIN_ID+".classpathContainer."; //$NON-NLS-1$ >@@ -862,13 +867,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 >@@ -984,7 +985,8 @@ > public IJavaModelStatus rawClasspathStatus; > public IClasspathEntry[] resolvedClasspath; > public IJavaModelStatus unresolvedEntryStatus; >- public Map resolvedPathToRawEntries; // reverse map from resolved path to raw entries >+ public Map rootPathToRawEntries; // reverse map from a package fragment root's path to the raw entry >+ public Map rootPathToResolvedEntries; // map from a package fragment root's path to the resolved entry > public IPath outputLocation; > > public IEclipsePreferences preferences; >@@ -1022,10 +1024,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 newRootPathToRawEntries, Map newRootPathToResolvedEntries, IJavaModelStatus newUnresolvedEntryStatus) { > // remember old info > JavaModelManager manager = JavaModelManager.getJavaModelManager(); > DeltaProcessor deltaProcessor = manager.deltaState.getDeltaProcessor(); >@@ -1035,7 +1037,8 @@ > this.outputLocation = newOutputLocation; > this.rawClasspathStatus = newRawClasspathStatus; > this.resolvedClasspath = newResolvedClasspath; >- this.resolvedPathToRawEntries = newResolvedPathToRawEntries; >+ this.rootPathToRawEntries = newRootPathToRawEntries; >+ this.rootPathToResolvedEntries = newRootPathToResolvedEntries; > this.unresolvedEntryStatus = newUnresolvedEntryStatus; > this.javadocCache = new LRUCache(JAVADOC_CACHE_INITIAL_SIZE); > } >@@ -1090,7 +1093,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 13:43:51 -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/DeltaProcessingState.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java,v >retrieving revision 1.41 >diff -u -r1.41 DeltaProcessingState.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessingState.java 10 Apr 2007 17:01:55 -0000 1.41 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessingState.java 13 Apr 2007 13:43:52 -0000 >@@ -235,12 +235,11 @@ > > // source attachment path > if (entry.getEntryKind() != IClasspathEntry.CPE_LIBRARY) continue; >- QualifiedName qName = new QualifiedName(JavaCore.PLUGIN_ID, "sourceattachment: " + path.toOSString()); //$NON-NLS-1$; > String propertyString = null; > try { >- propertyString = ResourcesPlugin.getWorkspace().getRoot().getPersistentProperty(qName); >- } catch (CoreException e) { >- continue; >+ propertyString = Util.getSourceAttachmentProperty(path); >+ } catch (JavaModelException e) { >+ e.printStackTrace(); > } > IPath sourceAttachmentPath; > if (propertyString != null) { >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 13:43:54 -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/JavaSearchScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java,v >retrieving revision 1.56 >diff -u -r1.56 JavaSearchScope.java >--- search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 6 Mar 2007 02:38:51 -0000 1.56 >+++ search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 13 Apr 2007 13:43:55 -0000 >@@ -129,9 +129,9 @@ > switch (entry.getEntryKind()) { > case IClasspathEntry.CPE_LIBRARY: > IClasspathEntry rawEntry = null; >- Map resolvedPathToRawEntries = perProjectInfo.resolvedPathToRawEntries; >- if (resolvedPathToRawEntries != null) { >- rawEntry = (IClasspathEntry) resolvedPathToRawEntries.get(entry.getPath()); >+ Map rootPathToRawEntries = perProjectInfo.rootPathToRawEntries; >+ if (rootPathToRawEntries != null) { >+ rawEntry = (IClasspathEntry) rootPathToRawEntries.get(entry.getPath()); > } > if (rawEntry == null) break; > switch (rawEntry.getEntryKind()) { >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 13:43:55 -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 13:43:55 -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 {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 145329
:
63480
|
63740
| 63741