mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +02:00
Fix to PR 53253
This commit is contained in:
parent
183e1ab403
commit
9bd8b6fb3a
2 changed files with 54 additions and 39 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-03-01 Alain Magloire
|
||||
|
||||
Fix to PR 53253. From Steve Garbarini
|
||||
|
||||
* src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
|
||||
|
||||
2004-03-01 Alain Magloire
|
||||
|
||||
Patch from Uwe Stieber
|
||||
|
|
|
@ -1,54 +1,63 @@
|
|||
package org.eclipse.cdt.internal.errorparsers;
|
||||
|
||||
/*
|
||||
* (c) Copyright IBM Corp. 2000, 2001.
|
||||
* All Rights Reserved.
|
||||
* (c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.IErrorParser;
|
||||
import org.eclipse.cdt.core.IMarkerGenerator;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
||||
public class VCErrorParser implements IErrorParser {
|
||||
|
||||
public boolean processLine(String line, ErrorParserManager eoParser) {
|
||||
// msdev: filname(linenumber) : error/warning error_desc
|
||||
int firstColon= line.indexOf(':');
|
||||
if (firstColon != -1) {
|
||||
String firstPart= line.substring(0, firstColon);
|
||||
StringTokenizer tok= new StringTokenizer(firstPart, "()");
|
||||
if (tok.hasMoreTokens()) {
|
||||
String fileName= tok.nextToken();
|
||||
if (tok.hasMoreTokens()) {
|
||||
String lineNumber= tok.nextToken();
|
||||
try {
|
||||
int num= Integer.parseInt(lineNumber);
|
||||
int i= fileName.lastIndexOf(File.separatorChar);
|
||||
if (i != -1) {
|
||||
fileName= fileName.substring(i + 1);
|
||||
public boolean processLine(String line, ErrorParserManager eoParser) {
|
||||
// msdev: filname(linenumber) : error/warning error_desc
|
||||
int firstColon = line.indexOf(':');
|
||||
if (firstColon != -1) {
|
||||
/* Guard against drive in Windows platform. */
|
||||
if (firstColon == 1) {
|
||||
try {
|
||||
String os = System.getProperty("os.name");
|
||||
if (os != null && os.startsWith("Win")) {
|
||||
try {
|
||||
if (Character.isLetter(line.charAt(0))) {
|
||||
firstColon = line.indexOf(':', 2);
|
||||
}
|
||||
} catch (StringIndexOutOfBoundsException e) {
|
||||
}
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
}
|
||||
}
|
||||
IFile file= eoParser.findFileName(fileName);
|
||||
if (file != null || eoParser.isConflictingName(fileName)) {
|
||||
String desc= line.substring(firstColon + 1).trim();
|
||||
if (file == null) {
|
||||
desc= "*" + desc;
|
||||
}
|
||||
int severity= IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
||||
if (desc.startsWith("warning")) {
|
||||
severity= IMarkerGenerator.SEVERITY_WARNING;
|
||||
}
|
||||
eoParser.generateMarker(file, num, desc, severity, null);
|
||||
return true;
|
||||
String firstPart = line.substring(0, firstColon);
|
||||
StringTokenizer tok = new StringTokenizer(firstPart, "()");
|
||||
if (tok.hasMoreTokens()) {
|
||||
String fileName = tok.nextToken();
|
||||
if (tok.hasMoreTokens()) {
|
||||
String lineNumber = tok.nextToken();
|
||||
try {
|
||||
int num = Integer.parseInt(lineNumber);
|
||||
int i = fileName.lastIndexOf(File.separatorChar);
|
||||
if (i != -1) {
|
||||
fileName = fileName.substring(i + 1);
|
||||
}
|
||||
IFile file = eoParser.findFileName(fileName);
|
||||
if (file != null || eoParser.isConflictingName(fileName)) {
|
||||
String desc = line.substring(firstColon + 1).trim();
|
||||
if (file == null) {
|
||||
desc = "*" + desc;
|
||||
}
|
||||
int severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
|
||||
if (desc.startsWith("warning")) {
|
||||
severity = IMarkerGenerator.SEVERITY_WARNING;
|
||||
}
|
||||
eoParser.generateMarker(file, num, desc, severity, null);
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue