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 82044 Details for
Bug 208685
Error parsers easily get confused when compilation directory is not known
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]
Proposed fix
208685_fix.txt (text/plain), 5.20 KB, created by
Sergey Prigogin
on 2007-11-03 20:30:58 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Sergey Prigogin
Created:
2007-11-03 20:30:58 EDT
Size:
5.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.core >Index: src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java,v >retrieving revision 1.6 >diff -u -r1.6 GASErrorParser.java >--- src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java 22 Jul 2005 02:36:06 -0000 1.6 >+++ src/org/eclipse/cdt/internal/errorparsers/GASErrorParser.java 4 Nov 2007 00:17:35 -0000 >@@ -50,11 +50,7 @@ > file = eoParser.findFileName(fileName); > } > } >- boolean isConflicting = false; >- if (file != null) { >- isConflicting = eoParser.isConflictingName(fileName); >- file = null; >- } else { >+ if (file == null) { > file = eoParser.findFileName(fileName); > } > if (file == null) { >Index: src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java,v >retrieving revision 1.7 >diff -u -r1.7 ErrorPattern.java >--- src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java 14 Jun 2007 18:04:00 -0000 1.7 >+++ src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java 4 Nov 2007 00:17:35 -0000 >@@ -131,7 +131,7 @@ > IResource file = null; > if (fileName != null) { > file = eoParser.findFileName(fileName); >- if (file == null || eoParser.isConflictingName(fileName)) { >+ if (file == null) { > file = eoParser.findFilePath(fileName); > } > >Index: src/org/eclipse/cdt/core/ErrorParserManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/ErrorParserManager.java,v >retrieving revision 1.32 >diff -u -r1.32 ErrorParserManager.java >--- src/org/eclipse/cdt/core/ErrorParserManager.java 14 Jun 2007 18:03:59 -0000 1.32 >+++ src/org/eclipse/cdt/core/ErrorParserManager.java 4 Nov 2007 00:17:35 -0000 >@@ -14,6 +14,7 @@ > import java.io.IOException; > import java.io.OutputStream; > import java.util.ArrayList; >+import java.util.Collection; > import java.util.HashMap; > import java.util.Iterator; > import java.util.LinkedHashMap; >@@ -42,8 +43,8 @@ > > private IProject fProject; > private IMarkerGenerator fMarkerGenerator; >- private Map fFilesInProject; >- private List fNameConflicts; >+ // Maps a file name without directory to a IFile object or a list of a IFile objects. >+ private Map fFilesInProject; // Files or lists of files keyed by the file name > > private Map fErrorParsers; > private ArrayList fErrors; >@@ -88,7 +89,6 @@ > > private void initErrorParserManager(IPath workingDirectory) { > fFilesInProject = new HashMap(); >- fNameConflicts = new ArrayList(); > fDirectoryStack = new Vector(); > fErrors = new ArrayList(); > >@@ -98,9 +98,18 @@ > > for (int i = 0; i < collectedFiles.size(); i++) { > IFile file = (IFile) collectedFiles.get(i); >- Object existing = fFilesInProject.put(file.getName(), file); >+ String filename = file.getName(); >+ Object existing = fFilesInProject.put(filename, file); > if (existing != null) { >- fNameConflicts.add(file.getName()); >+ Collection files; >+ if (existing instanceof IFile) { >+ files = new ArrayList(); >+ files.add(existing); >+ } else { >+ files = (Collection) existing; >+ } >+ files.add(file); >+ fFilesInProject.put(filename, files); > } > } > } >@@ -233,11 +242,35 @@ > } > > /** >- * Called by the error parsers. >+ * Returns the project file with the given name if that file can be uniquely identified. >+ * Otherwise returns <code>null</code>. > */ > public IFile findFileName(String fileName) { > IPath path = new Path(fileName); >- return (IFile) fFilesInProject.get(path.lastSegment()); >+ Object obj = fFilesInProject.get(path.lastSegment()); >+ if (obj == null || obj instanceof IFile) { >+ return (IFile) obj; >+ } >+ Collection files = (Collection) obj; >+ IFile matchingFile = null; >+ for (Iterator it = files.iterator(); it.hasNext();) { >+ IFile file = (IFile) it.next(); >+ IPath location = file.getLocation(); >+ boolean match = false; >+ if (path.isAbsolute()) { >+ match = path.equals(location); >+ } else { >+ int prefixLen = location.segmentCount() - path.segmentCount(); >+ match = prefixLen >= 0 && location.removeFirstSegments(prefixLen).equals(path); >+ } >+ if (match) { >+ if (matchingFile != null) { >+ return null; // Ambiguous match >+ } >+ matchingFile = file; >+ } >+ } >+ return matchingFile; > } > > protected IFile findFileInWorkspace(IPath path) { >@@ -263,12 +296,13 @@ > } > > /** >- * Called by the error parsers. >+ * Returns <code>true</code> if the project contains more than one file with the given name. > */ >- public boolean isConflictingName(String fileName) { >- IPath path = new Path(fileName); >- return fNameConflicts.contains(path.lastSegment()); >- } >+// public boolean isConflictingName(String fileName) { >+// IPath path = new Path(fileName); >+// Object obj = fFilesInProject.get(path.lastSegment()); >+// return obj != null && !(obj instanceof IFile); >+// } > > /** > * Called by the error parsers.
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
Flags:
cdtdoug
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 208685
: 82044