From 59b83a92e1c6d226a509027517bcd97c6c87ce24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norbert=20Pl=F6tt?= Date: Thu, 14 Dec 2006 13:18:08 +0000 Subject: [PATCH] bug #165205 - error parser messages externalized --- .../internal/errorparsers/GCCErrorParser.java | 19 +++++---- .../internal/errorparsers/GLDErrorParser.java | 9 ++-- .../errorparsers/MakeErrorParser.java | 7 ++-- .../cdt/internal/errorparsers/Messages.java | 41 +++++++++++++++++++ .../internal/errorparsers/messages.properties | 25 +++++++++++ 5 files changed, 85 insertions(+), 16 deletions(-) create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java create mode 100644 core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java index 769d505cbb7..8127e4d6f94 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * James Blackburn - Patch for PR 85264 + * Norbert Ploett (Siemens AG) - externalized strings *******************************************************************************/ package org.eclipse.cdt.internal.errorparsers; @@ -20,20 +21,20 @@ import org.eclipse.cdt.core.IMarkerGenerator; public class GCCErrorParser extends AbstractErrorParser { private static final Pattern[] varPatterns = { - Pattern.compile("'(.*)' undeclared"), - Pattern.compile("'(.*)' defined but not used"), - Pattern.compile("conflicting types for '(.*)'"), - Pattern.compile("parse error before '(.*)'") + Pattern.compile(Messages.GCCErrorParser_varPattern_undeclared), + Pattern.compile(Messages.GCCErrorParser_varPattern_defdNotUsed), + Pattern.compile(Messages.GCCErrorParser_varPattern_conflictTypes), + Pattern.compile(Messages.GCCErrorParser_varPattern_parseError) }; private static final ErrorPattern[] patterns = { // The following are skipped - new ErrorPattern("\\(Each undeclared identifier is reported only once"), - new ErrorPattern("for each function it appears in.\\)"), - new ErrorPattern(": note:"), - new ErrorPattern("instantiated from here"), + new ErrorPattern(Messages.GCCErrorParser_skip_UndeclaredOnlyOnce), + new ErrorPattern(Messages.GCCErrorParser_skip_forEachFunction), + new ErrorPattern(Messages.GCCErrorParser_skip_note), + new ErrorPattern(Messages.GCCErrorParser_sikp_instantiatedFromHere), // The following are not... - new ErrorPattern("(.*?):([0-9]+):([0-9]+:)? ((.*?[Ww]arning)?.*)", 1, 2, 4, 0, 0) { + new ErrorPattern(Messages.GCCErrorParser_Warnings, 1, 2, 4, 0, 0) { public String getVarName(Matcher matcher) { String desc = getDesc(matcher); Matcher varMatcher = null; diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java index a5a9f8d9d6a..e9df1cb75ae 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java @@ -7,7 +7,8 @@ * * Contributors: * IBM Corporation - initial API and implementation - *******************************************************************************/ + * Norbert Ploett (Siemens AG) - externalized strings +*******************************************************************************/ package org.eclipse.cdt.internal.errorparsers; @@ -18,9 +19,9 @@ import org.eclipse.cdt.core.IMarkerGenerator; public class GLDErrorParser extends AbstractErrorParser { private static final ErrorPattern[] patterns = { - new ErrorPattern("(.*)\\(\\.text\\+.*\\): (.*)", 1, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1 - new ErrorPattern("ld(\\.exe)?: ([Ww]arning .*)", 2, IMarkerGenerator.SEVERITY_WARNING), //$NON-NLS-1 - new ErrorPattern("ld(\\.exe)?: (.*)", 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1 + new ErrorPattern(Messages.GLDErrorParser_error_text, 1, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1 + new ErrorPattern(Messages.GLDErrorParser_warning_general, 2, IMarkerGenerator.SEVERITY_WARNING), //$NON-NLS-1 + new ErrorPattern(Messages.GLDErrorParser_error_general, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1 public String getDesc(Matcher matcher) { // add in the name of the link command to give it some context StringBuffer buff = new StringBuffer(); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java index 2927a16ea6c..9909d9ecbab 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Norbert Ploett (Siemens AG) - externalized strings *******************************************************************************/ package org.eclipse.cdt.internal.errorparsers; @@ -20,7 +21,7 @@ import org.eclipse.core.runtime.Path; public class MakeErrorParser extends AbstractErrorParser { private static final ErrorPattern[] patterns = { - new ErrorPattern("make\\[(.*)\\]: Entering directory `(.*)'", 0, 0) { //$NON-NLS-1 + new ErrorPattern(Messages.MakeErrorParser_error_entering, 0, 0) { //$NON-NLS-1 protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { int level; try { @@ -41,13 +42,13 @@ public class MakeErrorParser extends AbstractErrorParser { return true; } }, - new ErrorPattern("make\\[.*\\]: Leaving directory", 0, 0) { //$NON-NLS-1 + new ErrorPattern(Messages.MakeErrorParser_error_leaving, 0, 0) { //$NON-NLS-1 protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { eoParser.popDirectory(); return true; } }, - new ErrorPattern("(make: \\*\\*\\* \\[.*\\] Error .*)", 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1 + new ErrorPattern(Messages.MakeErrorParser_error_general, 1, IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { //$NON-NLS-1 protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) { if (!eoParser.hasErrors()) super.recordError(matcher, eoParser); diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java new file mode 100644 index 00000000000..b90071d5644 --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/Messages.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2006 Siemens AG. + * All rights reserved. This content and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Norbert Ploett - Initial implementation + *******************************************************************************/ + + +package org.eclipse.cdt.internal.errorparsers; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.errorparsers.messages"; //$NON-NLS-1$ + public static String GCCErrorParser_sikp_instantiatedFromHere; + public static String GCCErrorParser_skip_forEachFunction; + public static String GCCErrorParser_skip_note; + public static String GCCErrorParser_skip_UndeclaredOnlyOnce; + public static String GCCErrorParser_varPattern_conflictTypes; + public static String GCCErrorParser_varPattern_defdNotUsed; + public static String GCCErrorParser_varPattern_parseError; + public static String GCCErrorParser_varPattern_undeclared; + public static String GCCErrorParser_Warnings; + public static String GLDErrorParser_error_general; + public static String GLDErrorParser_error_text; + public static String GLDErrorParser_warning_general; + public static String MakeErrorParser_error_entering; + public static String MakeErrorParser_error_general; + public static String MakeErrorParser_error_leaving; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties new file mode 100644 index 00000000000..a3bb6a1888e --- /dev/null +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/messages.properties @@ -0,0 +1,25 @@ +############################################################################### +# Copyright (c) 2006 Siemens AG. +# All rights reserved. This content and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Norbert Ploett - Initial implementation +############################################################################### +GCCErrorParser_varPattern_undeclared='(.*)' undeclared +GCCErrorParser_varPattern_defdNotUsed='(.*)' defined but not used +GCCErrorParser_varPattern_conflictTypes=conflicting types for '(.*)' +GCCErrorParser_varPattern_parseError=parse error before '(.*)' +GCCErrorParser_skip_UndeclaredOnlyOnce=\\(Each undeclared identifier is reported only once +GCCErrorParser_skip_forEachFunction=for each function it appears in.\\) +GCCErrorParser_skip_note=: note: +GCCErrorParser_sikp_instantiatedFromHere=instantiated from here +GCCErrorParser_Warnings=(.*?):([0-9]+):([0-9]+:)? ((.*?[Ww]arning)?.*) +GLDErrorParser_error_text=(.*)\\(\\.text\\+.*\\): (.*) +GLDErrorParser_warning_general=ld(\\.exe)?: ([Ww]arning .*) +GLDErrorParser_error_general=ld(\\.exe)?: (.*) +MakeErrorParser_error_entering=make\\[(.*)\\]: Entering directory `(.*)' +MakeErrorParser_error_leaving=make\\[.*\\]: Leaving directory +MakeErrorParser_error_general=(make: \\*\\*\\* \\[.*\\] Error .*)