1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 53213 Externalize Strings for Tanya Wolff

This commit is contained in:
Andrew Niefer 2004-03-03 15:10:01 +00:00
parent a84395e43f
commit ba12f674af
15 changed files with 154 additions and 26 deletions

View file

@ -1,3 +1,16 @@
2004-03-02 Tanya Wolff
Fixed missing key for Working Set name and content on
new C/C++ Working set dialog. Also added error handling for when
properties files are not found.
All *Messages.java files are affected by the error handling.
The fix for working set is in:
* src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java
2004-03-02 Alain Magloire 2004-03-02 Alain Magloire
From Dave Daoust: From Dave Daoust:

View file

@ -12,8 +12,14 @@ import java.util.ResourceBundle;
public class TemplateMessages { public class TemplateMessages {
private static final String RESOURCE_BUNDLE= TemplateMessages.class.getName(); private static final String RESOURCE_BUNDLE= TemplateMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private TemplateMessages() { private TemplateMessages() {
} }
@ -22,6 +28,8 @@ public class TemplateMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -12,8 +12,14 @@ import java.util.ResourceBundle;
public class TemplateMessages { public class TemplateMessages {
private static final String RESOURCE_BUNDLE= TemplateMessages.class.getName(); private static final String RESOURCE_BUNDLE= TemplateMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private TemplateMessages() { private TemplateMessages() {
} }
@ -22,6 +28,8 @@ public class TemplateMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -19,16 +19,25 @@ public class TextManipulationMessages {
private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.corext.textmanipulation.Messages"; //$NON-NLS-1$ private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.corext.textmanipulation.Messages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private TextManipulationMessages() { private TextManipulationMessages() {
} }
public static String getString(String key) { public static String getString(String key) {
try { try {
return RESOURCE_BUNDLE.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -18,7 +18,14 @@ public class CUIMessages {
private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.CUIMessages";//$NON-NLS-1$ private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.CUIMessages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private CUIMessages() { private CUIMessages() {
} }
@ -28,6 +35,8 @@ public class CUIMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -22,7 +22,14 @@ public class ActionMessages {
private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.ui.actions.ActionMessages"; //$NON-NLS-1$ private static final String BUNDLE_NAME= "org.eclipse.cdt.internal.ui.actions.ActionMessages"; //$NON-NLS-1$
private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private ActionMessages() { private ActionMessages() {
// no instance // no instance
@ -37,9 +44,11 @@ public class ActionMessages {
*/ */
public static String getString(String key) { public static String getString(String key) {
try { try {
return RESOURCE_BUNDLE.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -18,7 +18,14 @@ public class CViewMessages {
private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.cview.CViewMessages";//$NON-NLS-1$ private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.cview.CViewMessages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private CViewMessages() { private CViewMessages() {
} }
@ -28,6 +35,8 @@ public class CViewMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -14,7 +14,14 @@ public class CEditorMessages
private static final String RESOURCE_BUNDLE = "org.eclipse.cdt.internal.ui.editor.CEditorMessages"; //$NON-NLS-1$ private static final String RESOURCE_BUNDLE = "org.eclipse.cdt.internal.ui.editor.CEditorMessages"; //$NON-NLS-1$
private static ResourceBundle fgResourceBundle = ResourceBundle.getBundle( RESOURCE_BUNDLE ); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private CEditorMessages() private CEditorMessages()
@ -36,6 +43,8 @@ public class CEditorMessages
catch( MissingResourceException e ) catch( MissingResourceException e )
{ {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$ return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
} }

View file

@ -18,7 +18,14 @@ public class OpenTypeMessages {
private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.opentype.OpenTypeMessages";//$NON-NLS-1$ private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.opentype.OpenTypeMessages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private OpenTypeMessages() { private OpenTypeMessages() {
} }
@ -28,6 +35,8 @@ public class OpenTypeMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -18,7 +18,14 @@ public class PreferencesMessages {
private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$ private static final String RESOURCE_BUNDLE= "org.eclipse.cdt.internal.ui.preferences.PreferencesMessages";//$NON-NLS-1$
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private PreferencesMessages() { private PreferencesMessages() {
} }
@ -28,6 +35,8 @@ public class PreferencesMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -26,7 +26,14 @@ import java.util.ResourceBundle;
public class CSearchMessages { public class CSearchMessages {
private static final String RESOURCE_BUNDLE= CSearchMessages.class.getName(); private static final String RESOURCE_BUNDLE= CSearchMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private CSearchMessages() { private CSearchMessages() {
} }
@ -36,6 +43,8 @@ public class CSearchMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }
/** /**

View file

@ -12,7 +12,14 @@ import java.util.ResourceBundle;
public class LinkedPositionMessages { public class LinkedPositionMessages {
private static final String RESOURCE_BUNDLE= LinkedPositionMessages.class.getName(); private static final String RESOURCE_BUNDLE= LinkedPositionMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private LinkedPositionMessages() { private LinkedPositionMessages() {
} }
@ -22,6 +29,8 @@ public class LinkedPositionMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -19,7 +19,14 @@ import java.util.ResourceBundle;
public class NewWizardMessages { public class NewWizardMessages {
private static final String RESOURCE_BUNDLE= NewWizardMessages.class.getName(); private static final String RESOURCE_BUNDLE= NewWizardMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private NewWizardMessages() { private NewWizardMessages() {
} }
@ -29,6 +36,8 @@ public class NewWizardMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return '!' + key + '!'; return '!' + key + '!';
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }

View file

@ -60,7 +60,8 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPage { public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPage {
final private static String PAGE_TITLE= WorkingSetMessages.getString("CElementWorkingSetPage.title"); //$NON-NLS-1$ final private static String PAGE_TITLE= WorkingSetMessages.getString("CElementWorkingSetPage.title"); //$NON-NLS-1$
final private static String PAGE_ID= WorkingSetMessages.getString("CElementWorkingSetPage"); //$NON-NLS-1$ //final private static String PAGE_ID= WorkingSetMessages.getString("CElementWorkingSetPage"); //$NON-NLS-1$
final private static String PAGE_ID= "CElementWorkingSetPage"; //$NON-NLS-1$
private final static int SIZING_SELECTION_WIDGET_WIDTH = 50; private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200; private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
@ -118,7 +119,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
//WorkbenchHelp.setHelp(composite, IHelpContextIds.WORKING_SET_RESOURCE_PAGE); //WorkbenchHelp.setHelp(composite, IHelpContextIds.WORKING_SET_RESOURCE_PAGE);
Label label = new Label(composite, SWT.WRAP); Label label = new Label(composite, SWT.WRAP);
label.setText(WorkingSetMessages.getString("CElementWorkingSetPage.content")); //$NON-NLS-1$ label.setText(WorkingSetMessages.getString("CElementWorkingSetPage.name")); //$NON-NLS-1$
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
label.setLayoutData(data); label.setLayoutData(data);
label.setFont(font); label.setFont(font);
@ -136,7 +137,7 @@ public class CElementWorkingSetPage extends WizardPage implements IWorkingSetPag
text.setFocus(); text.setFocus();
label = new Label(composite, SWT.WRAP); label = new Label(composite, SWT.WRAP);
label.setText(WorkingSetMessages.getString("CElementWorkingSetPage.label.tree")); //$NON-NLS-1$ label.setText(WorkingSetMessages.getString("CElementWorkingSetPage.content")); //$NON-NLS-1$
data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
label.setLayoutData(data); label.setLayoutData(data);
label.setFont(font); label.setFont(font);

View file

@ -18,8 +18,14 @@ class WorkingSetMessages {
private static final String RESOURCE_BUNDLE= WorkingSetMessages.class.getName(); private static final String RESOURCE_BUNDLE= WorkingSetMessages.class.getName();
private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE); private static ResourceBundle fgResourceBundle;
static {
try {
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
} catch (MissingResourceException x) {
fgResourceBundle = null;
}
}
private WorkingSetMessages() { private WorkingSetMessages() {
} }
@ -28,6 +34,8 @@ class WorkingSetMessages {
return fgResourceBundle.getString(key); return fgResourceBundle.getString(key);
} catch (MissingResourceException e) { } catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
} catch (NullPointerException e) {
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
} }
} }