Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] patch for refactoring

The patch adds filepath and linenumber to warnings about
AST problems found during refactoring.

Markus.
Index: src/org/eclipse/cdt/internal/refactoring/ASTManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.refactoring/src/org/eclipse/cdt/internal/refactoring/ASTManager.java,v
retrieving revision 1.9
diff -u -r1.9 ASTManager.java
--- src/org/eclipse/cdt/internal/refactoring/ASTManager.java	30 May 2005 20:32:50 -0000	1.9
+++ src/org/eclipse/cdt/internal/refactoring/ASTManager.java	31 May 2005 13:31:56 -0000
@@ -1174,15 +1174,25 @@
 
     public void handleProblemBinding(IASTTranslationUnit tu, final IProblemBinding pb, RefactoringStatus status) {
         if (tu != null) {
-            if (fProblemUnits.add(tu.getFilePath())) {
+            String fpath= tu.getFilePath();
+            if (fProblemUnits.add(fpath)) {
                 String msg= pb.getMessage();
                 if (msg != null && msg.length() > 0) {
-                    msg= MessageFormat.format(Messages.getString("ASTManager.warning.parsingErrors.detailed"), new Object[]{msg}); //$NON-NLS-1$
+                    msg= MessageFormat.format(Messages.getString("ASTManager.warning.parsingError.detailed"), new Object[]{msg}); //$NON-NLS-1$
+                }
+                else {
+                    msg= Messages.getString("ASTManager.warning.parsingError"); //$NON-NLS-1$
+                }
+                int line= pb.getLineNumber();
+                if (line >= 1) {
+                    msg= MessageFormat.format(
+                            Messages.getString("ASTManager.warning.parsingError.withFileAndLine"),  //$NON-NLS-1$
+                            new Object[] {msg, fpath, new Integer(line)});
                 }
                 else {
                     msg= MessageFormat.format(
-                            Messages.getString("ASTManager.warning.parsingErrors"), //$NON-NLS-1$
-                            new Object[] {tu.getFilePath()});
+                            Messages.getString("ASTManager.warning.parsingError.withFile"),  //$NON-NLS-1$
+                            new Object[] {msg, fpath});
                 }
                 status.addWarning(msg);
             }
Index: src/org/eclipse/cdt/internal/refactoring/messages.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt-core/org.eclipse.cdt.refactoring/src/org/eclipse/cdt/internal/refactoring/messages.properties,v
retrieving revision 1.5
diff -u -r1.5 messages.properties
--- src/org/eclipse/cdt/internal/refactoring/messages.properties	21 May 2005 19:09:19 -0000	1.5
+++ src/org/eclipse/cdt/internal/refactoring/messages.properties	31 May 2005 13:31:56 -0000
@@ -77,6 +77,8 @@
 ASTManager.task.analyze=Analyzing source code
 ASTManager.task.generateAst=Generating AST
 ASTManager.subtask.analyzing=Analyzing {0} files
-ASTManager.warning.parsingErrors=Parsing error in file ''{0}'', the refactoring may not be accurate.
-ASTManager.warning.parsingErrors.detailed=Parsing Error: {0}
+ASTManager.warning.parsingError=Parsing error
+ASTManager.warning.parsingError.detailed=Parsing error - {0} - 
+ASTManager.warning.parsingError.withFile={0} in file ''{1}''
+ASTManager.warning.parsingError.withFileAndLine={0} in file ''{1}'' at line ''{2}''
 ASTManager.error.macro.name.conflict=''{0}'' conflicts with the name of an existing macro\!

Back to the top