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 43496 Details for
Bug 142328
[j2ee] Build path contains duplicate entries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for FlexibleProjectContainer
142328patch.txt (text/plain), 4.86 KB, created by
Jason Sholl
on 2006-06-05 13:07:11 EDT
(
hide
)
Description:
patch for FlexibleProjectContainer
Filename:
MIME Type:
Creator:
Jason Sholl
Created:
2006-06-05 13:07:11 EDT
Size:
4.86 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.common.frameworks >Index: src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java >=================================================================== >RCS file: /cvsroot/webtools/jst/components/common/plugins/org.eclipse.jst.common.frameworks/src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java,v >retrieving revision 1.21 >diff -u -r1.21 FlexibleProjectContainer.java >--- src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java 24 May 2006 16:43:03 -0000 1.21 >+++ src/org/eclipse/jst/common/jdt/internal/classpath/FlexibleProjectContainer.java 5 Jun 2006 17:09:44 -0000 >@@ -37,6 +37,10 @@ > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.internal.core.ClasspathEntry; >+import org.eclipse.jdt.internal.core.JavaProject; >+import org.eclipse.jdt.internal.core.util.Util; >+import org.eclipse.jem.util.logger.proxy.Logger; > import org.eclipse.jst.common.frameworks.CommonFrameworksPlugin; > import org.eclipse.wst.common.componentcore.ComponentCore; > import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent; >@@ -161,6 +165,15 @@ > > private List computeClasspathEntries() > { >+ IJavaProject javaProject = JavaCore.create(this.project); >+ IClasspathEntry[] existingEntries = null; >+ try { >+ existingEntries = javaProject.getResolvedClasspath(true); >+ } catch (JavaModelException e) { >+ existingEntries = new IClasspathEntry[0]; >+ Logger.getLogger().logError(e); >+ } >+ > final List entries = new ArrayList(); > > final IVirtualComponent vc >@@ -179,20 +192,27 @@ > if(null != jarName){ > jarsHandled.add(jarName); > } >+ IPath newPath = null; > if (comp.isBinary()) { > VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) comp; > java.io.File diskFile = archiveComp.getUnderlyingDiskFile(); > if (diskFile.exists()) { >- entries.add(new Path(diskFile.getAbsolutePath())); >+ newPath =new Path(diskFile.getAbsolutePath()); > } else { > IFile iFile = archiveComp.getUnderlyingWorkbenchFile(); >- if (!entries.contains(iFile.getFullPath())) >- entries.add(iFile.getFullPath()); >+ if (!entries.contains(iFile.getFullPath())){ >+ newPath = iFile.getFullPath(); >+ } > } > } else { > IProject project = comp.getProject(); >- entries.add(project.getFullPath()); >+ newPath = project.getFullPath(); > } >+ >+ if(null != newPath && !isAlreadyOnClasspath(existingEntries, newPath)){ >+ entries.add(newPath); >+ } >+ > } > > for( int i = 0; i < this.paths.length; i++ ) >@@ -222,7 +242,9 @@ > if(!jarsHandled.contains(p.lastSegment()) && isJarFile( r.getLocation().toFile() ) ) > { > jarsHandled.add(p.lastSegment()); >- entries.add( p ); >+ if(!isAlreadyOnClasspath(existingEntries, p)){ >+ entries.add( p ); >+ } > } > } > } >@@ -238,7 +260,9 @@ > ! isSourceOrOutputDirectory( p ) ) > { > jarsHandled.add(p.lastSegment()); >- entries.add( p ); >+ if(!isAlreadyOnClasspath(existingEntries, p)){ >+ entries.add( p ); >+ } > } > } > } >@@ -348,6 +372,28 @@ > return false; > } > >+ /** >+ * Taken from {@link JavaProject#isOnClasspath(org.eclipse.core.resources.IResource)} >+ * >+ * @param classpath >+ * @param newPath >+ * @return >+ */ >+ public static boolean isAlreadyOnClasspath(IClasspathEntry[] classpath, IPath newPath) { >+ for (int i = 0; i < classpath.length; i++) { >+ IClasspathEntry entry = classpath[i]; >+ IPath entryPath = entry.getPath(); >+ if (entryPath.equals(newPath)) { // package fragment roots must match exactly entry >+ // pathes (no exclusion there) >+ return true; >+ } >+ if (entryPath.isPrefixOf(newPath) && !Util.isExcluded(newPath, ((ClasspathEntry) entry).fullInclusionPatternChars(), ((ClasspathEntry) entry).fullExclusionPatternChars(), false)) { >+ return true; >+ } >+ } >+ return false; >+ } >+ > private static class Listener > > implements IResourceChangeListener
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 142328
: 43496