1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Externalized string - fixed issues

This commit is contained in:
Alena Laskavaia 2010-05-08 01:22:37 +00:00
parent 95d8915fee
commit 26dc9d8c68
16 changed files with 64 additions and 125 deletions

View file

@ -8,4 +8,5 @@ CodeAnalysisPreferencesBuild.name = Launching
category.name = Code Analysis
command.name = Run Code Analysis
view.name = Problem Details
extension-point.name = Codan Problem Details
extension-point.name = Codan Problem Details
extension-point.name.codamMarkerResolution = Codan Marker Resolution

View file

@ -80,7 +80,7 @@
</view>
</extension>
<extension-point id="codanProblemDetails" name="%extension-point.name" schema="schema/codanProblemDetails.exsd"/>
<extension-point id="codanMarkerResolution" name="Codan Marker Resolution" schema="schema/codanMarkerResolution.exsd"/>
<extension-point id="codanMarkerResolution" name="%extension-point.name.codamMarkerResolution" schema="schema/codanMarkerResolution.exsd"/>
<!--
<extension
point="org.eclipse.ui.bindings">

View file

@ -13,9 +13,9 @@ package org.eclipse.cdt.codan.internal.ui;
import org.eclipse.osgi.util.NLS;
/**
* TODO: add description
* Externalized messages
*/
public class Messages extends NLS {
public class CodanUIMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.codan.internal.ui.messages"; //$NON-NLS-1$
public static String BuildPropertyPage_RunAsYouType;
public static String BuildPropertyPage_RunWithBuild;
@ -23,16 +23,27 @@ public class Messages extends NLS {
public static String CodanPreferencePage_Customize;
public static String CodanPreferencePage_HasParameters;
public static String CodanPreferencePage_Info;
public static String CodanPreferencePage_MessageLabel;
public static String CodanPreferencePage_NoInfo;
public static String CodanPreferencePage_NoParameters;
public static String ProblemsTreeEditor_NameColumn;
public static String ProblemsTreeEditor_Problems;
public static String ProblemsTreeEditor_SeverityColumn;
public static String OverlayPage_Use_Workspace_Settings;
public static String OverlayPage_Use_Project_Settings;
public static String OverlayPage_Configure_Workspace_Settings;
public static String PropertyStore_Cannot_write_resource_property;
public static String CustomizeProblemComposite_TabParameters;
public static String CustomizeProblemComposite_TabScope;
public static String CustomizeProblemDialog_Message;
public static String CustomizeProblemDialog_Title;
public static String Job_TitleRunningAnalysis;
public static String ParametersComposite_None;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
NLS.initializeMessages(BUNDLE_NAME, CodanUIMessages.class);
}
private Messages() {
private CodanUIMessages() {
}
}

View file

@ -1,33 +0,0 @@
/*******************************************************************************
* Copyright (c) 2009,2010 Alena Laskavaia
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alena Laskavaia - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui;
import org.eclipse.osgi.util.NLS;
/**
* UI Messages
*/
public class CodnaUIMessages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.codan.internal.ui"; //$NON-NLS-1$
public static String CustomizeProblemComposite_TabParameters;
public static String CustomizeProblemComposite_TabScope;
public static String CustomizeProblemDialog_Message;
public static String CustomizeProblemDialog_Title;
public static String Job_TitleRunningAnalysis;
public static String ParametersComposite_None;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, CodnaUIMessages.class);
}
private CodnaUIMessages() {
}
}

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.codan.internal.ui.actions;
import java.util.Iterator;
import org.eclipse.cdt.codan.core.CodanRuntime;
import org.eclipse.cdt.codan.internal.ui.CodnaUIMessages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@ -34,7 +34,7 @@ public class RunCodeAnalysis implements IObjectActionDelegate {
}
public void run(IAction action) {
Job job = new Job(CodnaUIMessages.Job_TitleRunningAnalysis) {
Job job = new Job(CodanUIMessages.Job_TitleRunningAnalysis) {
@SuppressWarnings("unchecked")
@Override
protected IStatus run(final IProgressMonitor monitor) {

View file

@ -12,7 +12,7 @@ package org.eclipse.cdt.codan.internal.ui.dialogs;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.internal.ui.CodnaUIMessages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@ -56,7 +56,7 @@ public class CustomizeProblemComposite extends Composite {
*/
private void createParamtersTab(TabFolder tabFolder) {
TabItem tabItem1 = new TabItem(tabFolder, SWT.NULL);
tabItem1.setText(CodnaUIMessages.CustomizeProblemComposite_TabParameters);
tabItem1.setText(CodanUIMessages.CustomizeProblemComposite_TabParameters);
parametersTab = new Composite(tabFolder, SWT.NONE);
tabItem1.setControl(parametersTab);
parametersTab.setLayout(new GridLayout());
@ -69,7 +69,7 @@ public class CustomizeProblemComposite extends Composite {
*/
private void createScopeTab(TabFolder tabFolder) {
TabItem tabItem1 = new TabItem(tabFolder, SWT.NULL);
tabItem1.setText(CodnaUIMessages.CustomizeProblemComposite_TabScope);
tabItem1.setText(CodanUIMessages.CustomizeProblemComposite_TabScope);
Composite comp = new Composite(tabFolder, SWT.NONE);
tabItem1.setControl(comp);
comp.setLayout(new GridLayout());

View file

@ -12,7 +12,7 @@ package org.eclipse.cdt.codan.internal.ui.dialogs;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.internal.ui.CodnaUIMessages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@ -51,9 +51,9 @@ public class CustomizeProblemDialog extends TitleAreaDialog {
*/
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText(CodnaUIMessages.CustomizeProblemDialog_Title);
getShell().setText(CodanUIMessages.CustomizeProblemDialog_Title);
setTitle(problem.getName());
setMessage(CodnaUIMessages.CustomizeProblemDialog_Message);
setMessage(CodanUIMessages.CustomizeProblemDialog_Message);
Composite area = (Composite) super.createDialogArea(parent);
comp = new CustomizeProblemComposite(area, problem);
GridData ld = new GridData(GridData.FILL_BOTH);

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.codan.internal.ui.dialogs;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemParameterInfo;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.internal.ui.CodnaUIMessages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.preference.StringFieldEditor;
@ -75,7 +75,7 @@ public class ParametersComposite extends Composite {
IProblemParameterInfo info = problem.getParameterInfo();
if (info == null) {
Label label = new Label(this, 0);
label.setText(CodnaUIMessages.ParametersComposite_None);
label.setText(CodanUIMessages.ParametersComposite_None);
}
initPrefStore(info);
page.setPreferenceStore(pref);

View file

@ -4,6 +4,7 @@ CheckedTreeEditor_SelectionCannotBeEmpty=Selection cannot be empty
CodanPreferencePage_Customize=Customize...
CodanPreferencePage_HasParameters=This problem has parameters
CodanPreferencePage_Info=Info
CodanPreferencePage_MessageLabel=Problem message
CodanPreferencePage_NoInfo=No additional information
CodanPreferencePage_NoParameters=No parameters
CustomizeProblemComposite_TabParameters=Parameters
@ -15,3 +16,8 @@ ParametersComposite_None=No Parameters
ProblemsTreeEditor_NameColumn=Name
ProblemsTreeEditor_Problems=Problems
ProblemsTreeEditor_SeverityColumn=Severity
OverlayPage_Use_Workspace_Settings=Use &workspace settings
OverlayPage_Use_Project_Settings=Use pr&oject settings
OverlayPage_Configure_Workspace_Settings=&Configure Workspace Settings...
PropertyStore_Cannot_write_resource_property=Cannot write resource property

View file

@ -2,7 +2,7 @@ package org.eclipse.cdt.codan.internal.ui.preferences;
import org.eclipse.cdt.codan.core.PreferenceConstants;
import org.eclipse.cdt.codan.internal.ui.CodanUIActivator;
import org.eclipse.cdt.codan.internal.ui.Messages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.cdt.codan.internal.ui.actions.ToggleNatureAction;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
@ -32,9 +32,9 @@ public class BuildPropertyPage extends FieldEditorPreferencePage implements
@Override
protected void createFieldEditors() {
addField(new BooleanFieldEditor(PreferenceConstants.P_RUN_ON_BUILD,
Messages.BuildPropertyPage_RunWithBuild, getFieldEditorParent()));
CodanUIMessages.BuildPropertyPage_RunWithBuild, getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceConstants.P_RUN_IN_EDITOR,
Messages.BuildPropertyPage_RunAsYouType, getFieldEditorParent()));
CodanUIMessages.BuildPropertyPage_RunAsYouType, getFieldEditorParent()));
}
@Override

View file

@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
import org.eclipse.cdt.codan.internal.ui.Messages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
@ -313,7 +313,7 @@ public abstract class CheckedTreeEditor extends FieldEditor implements
if (!emptySelectionAllowed) {
Object[] checkedElements = getTreeViewer().getCheckedElements();
if (checkedElements.length == 0) {
showErrorMessage(Messages.CheckedTreeEditor_SelectionCannotBeEmpty);
showErrorMessage(CodanUIMessages.CheckedTreeEditor_SelectionCannotBeEmpty);
return false;
}
}

View file

@ -16,7 +16,7 @@ import org.eclipse.cdt.codan.core.model.ICheckersRegistry;
import org.eclipse.cdt.codan.core.model.IProblem;
import org.eclipse.cdt.codan.core.model.IProblemParameterInfo;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
import org.eclipse.cdt.codan.internal.ui.Messages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.cdt.codan.internal.ui.dialogs.CustomizeProblemDialog;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.preferences.InstanceScope;
@ -63,7 +63,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
super(GRID);
setPreferenceStore(new ScopedPreferenceStore(new InstanceScope(),
CodanCorePlugin.PLUGIN_ID));
//setDescription("Code Analysis Preference Page");
// setDescription("Code Analysis Preference Page");
problemSelectionListener = new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
if (info != null) {
@ -127,14 +127,14 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
info = new Group(comp, SWT.NONE);
info.setLayoutData(new GridData(GridData.FILL_BOTH));
info.setLayout(new GridLayout(2, false));
info.setText(Messages.CodanPreferencePage_Info);
info.setText(CodanUIMessages.CodanPreferencePage_Info);
infoParams = new Label(info, SWT.NONE);
infoParams.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
false));
infoButton = new Button(info, SWT.PUSH);
infoButton
.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
infoButton.setText(Messages.CodanPreferencePage_Customize);
infoButton.setText(CodanUIMessages.CodanPreferencePage_Customize);
infoButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@ -144,7 +144,7 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
infoMessage = new Label(info, SWT.WRAP);
GridData ld = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
ld.horizontalSpan = 2;
ld.widthHint=400;
ld.widthHint = 400;
infoMessage.setLayoutData(ld);
setSelectedProblem(null);
}
@ -188,10 +188,12 @@ public class CodanPreferencePage extends FieldEditorOverlayPage implements
IProblemParameterInfo parameterInfo = selectedProblem
.getParameterInfo();
String desc = selectedProblem.getDescription();
infoMessage.setText(desc == null ? Messages.CodanPreferencePage_NoInfo
: desc);
infoParams.setText(parameterInfo == null ? Messages.CodanPreferencePage_NoParameters
: Messages.CodanPreferencePage_HasParameters);
if (desc == null)
desc = CodanUIMessages.CodanPreferencePage_NoInfo;
infoMessage.setText(desc);
infoParams
.setText(parameterInfo == null ? CodanUIMessages.CodanPreferencePage_NoParameters
: CodanUIMessages.CodanPreferencePage_HasParameters);
infoButton.setEnabled(true);
}
info.layout(true);

View file

@ -13,8 +13,10 @@ package org.eclipse.cdt.codan.internal.ui.preferences;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.codan.core.CodanCorePlugin;
import org.eclipse.cdt.codan.core.PreferenceConstants;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.IAdaptable;
@ -120,7 +122,8 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
* @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
*/
public IAdaptable getElement() {
if (element==null) return element;
if (element == null)
return element;
if (!(element instanceof IProject))
return (IAdaptable) element.getAdapter(IProject.class);
return element;
@ -205,13 +208,12 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
Composite radioGroup = new Composite(comp, SWT.NONE);
radioGroup.setLayout(new GridLayout());
radioGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
useWorkspaceSettingsButton = createRadioButton(radioGroup, Messages
.getString("OverlayPage.Use_Workspace_Settings")); //$NON-NLS-1$
useProjectSettingsButton = createRadioButton(radioGroup, Messages
.getString("OverlayPage.Use_Project_Settings")); //$NON-NLS-1$
useWorkspaceSettingsButton = createRadioButton(radioGroup,
CodanUIMessages.OverlayPage_Use_Workspace_Settings);
useProjectSettingsButton = createRadioButton(radioGroup,
CodanUIMessages.OverlayPage_Use_Project_Settings);
configureButton = new Button(comp, SWT.PUSH);
configureButton.setText(Messages
.getString("OverlayPage.Configure_Workspace_Settings")); //$NON-NLS-1$
configureButton.setText(CodanUIMessages.OverlayPage_Use_Workspace_Settings);
configureButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
configureWorkspaceSettings();
@ -327,6 +329,7 @@ public abstract class FieldEditorOverlayPage extends FieldEditorPreferencePage
/**
* Creates a new preferences page and opens it
*/
@SuppressWarnings("cast")
protected void configureWorkspaceSettings() {
try {
// create a new instance of the current class

View file

@ -1,47 +0,0 @@
/*******************************************************************************
* Copyright (c) 2003 Berthold Daum.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* Berthold Daum
*******************************************************************************/
package org.eclipse.cdt.codan.internal.ui.preferences;
import java.util.ResourceBundle;
public class Messages {
private final static String RESOURCE_BUNDLE = "org.eclipse.cdt.codan.internal.ui.preferences.Messages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle = null;
private static boolean notRead = true;
public Messages() {
}
public static ResourceBundle getResourceBundle() {
if (notRead) {
notRead = false;
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
}
catch (Exception e) {
}
}
return fgResourceBundle;
}
public static String getString(String key) {
try {
return getResourceBundle().getString(key);
} catch (Exception e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
}

View file

@ -1,4 +0,0 @@
OverlayPage.Use_Workspace_Settings=Use &workspace settings
OverlayPage.Use_Project_Settings=Use pr&oject settings
OverlayPage.Configure_Workspace_Settings=&Configure Workspace Settings...
PropertyStore.Cannot_write_resource_property=Cannot write resource property

View file

@ -18,7 +18,7 @@ import org.eclipse.cdt.codan.core.model.IProblemElement;
import org.eclipse.cdt.codan.core.model.IProblemProfile;
import org.eclipse.cdt.codan.core.model.IProblemWorkingCopy;
import org.eclipse.cdt.codan.internal.core.CodanPreferencesLoader;
import org.eclipse.cdt.codan.internal.ui.Messages;
import org.eclipse.cdt.codan.internal.ui.CodanUIMessages;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
@ -146,7 +146,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
public ProblemsTreeEditor(Composite parent, IProblemProfile profile) {
super(PreferenceConstants.P_PROBLEMS, Messages.ProblemsTreeEditor_Problems, parent);
super(PreferenceConstants.P_PROBLEMS, CodanUIMessages.ProblemsTreeEditor_Problems, parent);
setEmptySelectionAllowed(true);
getTreeViewer().getTree().setHeaderVisible(true);
// getTreeViewer().getTree().
@ -155,7 +155,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
// column Name
TreeViewerColumn column1 = new TreeViewerColumn(getTreeViewer(), SWT.NONE);
column1.getColumn().setWidth(300);
column1.getColumn().setText(Messages.ProblemsTreeEditor_NameColumn);
column1.getColumn().setText(CodanUIMessages.ProblemsTreeEditor_NameColumn);
column1.setLabelProvider(new ColumnLabelProvider() {
public String getText(Object element) {
if (element instanceof IProblem) {
@ -172,7 +172,7 @@ public class ProblemsTreeEditor extends CheckedTreeEditor {
// column Severity
TreeViewerColumn column2 = new TreeViewerColumn(getTreeViewer(), SWT.NONE);
column2.getColumn().setWidth(100);
column2.getColumn().setText(Messages.ProblemsTreeEditor_SeverityColumn);
column2.getColumn().setText(CodanUIMessages.ProblemsTreeEditor_SeverityColumn);
column2.setLabelProvider(new ColumnLabelProvider() {
@Override
public Image getImage(Object element) {