1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 331788 - NLS: Severities for Code Analysis Problem Preferences not externalized for translation

This commit is contained in:
Vivian Kong 2011-05-24 14:43:46 +00:00
parent 356e6cf4b2
commit a8138c9ba2
6 changed files with 51 additions and 12 deletions

View file

@ -15,5 +15,6 @@ bin.includes = META-INF/,\
plugin.xml,\
schema/,\
OSGI-INF/l10n/bundle.properties,\
about.html
about.html,\
OSGI-INF/
src.includes = schema/

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009,2010 Alena Laskavaia
* Copyright (c) 2009, 2011 Alena Laskavaia and others.
* All rights reserved. This program 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
@ -7,6 +7,7 @@
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.codan.core;
@ -24,6 +25,18 @@ public class Messages extends NLS {
public static String CodanApplication_Usage;
public static String CodanApplication_verbose_option;
public static String CodanBuilder_Code_Analysis_On;
/**
* @since 2.0
*/
public static String CodanSeverity_Error;
/**
* @since 2.0
*/
public static String CodanSeverity_Info;
/**
* @since 2.0
*/
public static String CodanSeverity_Warning;
public static String FileScopeProblemPreference_Label;
static {

View file

@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2010 Alena Laskavaia and others.
# Copyright (c) 2010, 2011 Alena Laskavaia and others.
# All rights reserved. This program 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
@ -7,6 +7,7 @@
#
# Contributors:
# Alena Laskavaia - initial API and implementation
# IBM Corporation
###############################################################################
CodanApplication_Error_ProjectDoesNotExists=Error: project {0} does not exist
CodanApplication_LogRunProject=Running code analysis on project
@ -16,4 +17,7 @@ CodanApplication_Options=Options:
CodanApplication_all_option= -all - run on all projects in workspace
CodanApplication_verbose_option= -verbose - print verbose build information
CodanBuilder_Code_Analysis_On=Code analysis on
CodanSeverity_Error=Error
CodanSeverity_Info=Info
CodanSeverity_Warning=Warning
FileScopeProblemPreference_Label=Exclusion and Inclusion

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2011 Alena Laskavaia and others.
* All rights reserved. This program 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
@ -7,16 +7,18 @@
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.codan.core.model;
import org.eclipse.cdt.codan.core.Messages;
import org.eclipse.core.resources.IMarker;
/**
*
*
* Represents Severity of the codan problem. It is directly mapped to markers
* severity.
*
*
*/
public enum CodanSeverity {
/**
@ -52,7 +54,7 @@ public enum CodanSeverity {
String[] svalues = new String[values.length];
for (int i = 0; i < values.length; i++) {
CodanSeverity sev = values[i];
svalues[i] = sev.toString();
svalues[i] = sev.toTranslatableString();
}
return svalues;
}
@ -71,4 +73,22 @@ public enum CodanSeverity {
return Error;
return null;
}
/**
* @return translated string value of this CodanSeverity
* @since 2.0
*/
public String toTranslatableString() {
switch (this) {
case Info:
return Messages.CodanSeverity_Info;
case Warning:
return Messages.CodanSeverity_Warning;
case Error:
default:
return Messages.CodanSeverity_Error;
}
}
}

View file

@ -273,7 +273,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
public String getText(Object element) {
if (element instanceof IProblem) {
IProblem p = (IProblem) element;
return p.getSeverity().toString();
return p.getSeverity().toTranslatableString();
}
return null;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2010 Alena Laskavaia
* Copyright (c) 2009, 2011 Alena Laskavaia and others.
* All rights reserved. This program 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
@ -7,6 +7,7 @@
*
* Contributors:
* Alena Laskavaia - initial API and implementation
* IBM Corporation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.widgets;
@ -70,9 +71,9 @@ public class ParametersComposite extends Composite {
noDefaultAndApplyButton();
((GridLayout) getFieldEditorParent().getLayout()).numColumns = 2;
addField(new BooleanFieldEditor(PREF_ENABLED, CodanUIMessages.ParametersComposite_IsEnabled, getFieldEditorParent()));
String[][] entries = { { CodanSeverity.Error.toString(), CodanSeverity.Error.toString() }, //
{ CodanSeverity.Warning.toString(), CodanSeverity.Warning.toString() }, //
{ CodanSeverity.Info.toString(), CodanSeverity.Info.toString() }, //
String[][] entries = { { CodanSeverity.Error.toTranslatableString(), CodanSeverity.Error.toString() }, //
{ CodanSeverity.Warning.toTranslatableString(), CodanSeverity.Warning.toString() }, //
{ CodanSeverity.Info.toTranslatableString(), CodanSeverity.Info.toString() }, //
{ NO_CHANGE, NO_CHANGE }, //
};
addField(new ComboFieldEditor(PREF_SEVERITY, CodanUIMessages.ParametersComposite_Severity, entries, getFieldEditorParent()));