Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2005-07-07 16:30:52 -0400
committerAndrew Niefer2005-07-07 16:30:52 -0400
commitae3e33131f14eee0d4ba8a9184104998265a4847 (patch)
tree800f363aecbfd6e13a721a2a49f5fcd1e7d041c4
parentaa3270e91a009d30e4f07d9a2cdd9476052e1dcf (diff)
downloadorg.eclipse.cdt-ae3e33131f14eee0d4ba8a9184104998265a4847.tar.gz
org.eclipse.cdt-ae3e33131f14eee0d4ba8a9184104998265a4847.tar.xz
org.eclipse.cdt-ae3e33131f14eee0d4ba8a9184104998265a4847.zip
bug 102847 line numbers on scanner problems
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ScannerASTProblem.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ScannerASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ScannerASTProblem.java
index a13b0f385e..267adf1596 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ScannerASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner2/ScannerASTProblem.java
@@ -16,6 +16,7 @@ import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@@ -268,7 +269,17 @@ public class ScannerASTProblem extends ASTNode implements IASTProblem {
msg = MessageFormat.format(msg, new Object[] { new String(arg) });
}
- Object[] args = new Object[] { msg, new String(""), new Integer(0) }; //$NON-NLS-1$
+ IASTFileLocation f = getFileLocation();
+ String file = null;
+ int line = 0;
+ if( f == null )
+ {
+ file = ""; //$NON-NLS-1$
+ } else {
+ file = f.getFileName();
+ line = f.getStartingLineNumber();
+ }
+ Object[] args = new Object[] { msg, file, new Integer(line) }; //$NON-NLS-1$
message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
return message;
}

Back to the top