Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fix for cdt.ui strings


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

Cheers,
Tanya

Index: ChangeLog
===================================================================
retrieving revision 1.289
diff -u -r1.289 ChangeLog
--- ChangeLog	2 Mar 2004 21:20:23 -0000	1.289
+++ ChangeLog	2 Mar 2004 22:32:31 -0000
@@ -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
 
 	From Dave Daoust:
Index: src/org/eclipse/cdt/internal/corext/template/TemplateMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 TemplateMessages.java
--- src/org/eclipse/cdt/internal/corext/template/TemplateMessages.java	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/corext/template/TemplateMessages.java	2 Mar 2004 22:32:35 -0000
@@ -12,8 +12,14 @@
 public class TemplateMessages {
 
 	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() {
 	}
 
@@ -22,6 +28,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/corext/template/c/TemplateMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 TemplateMessages.java
--- src/org/eclipse/cdt/internal/corext/template/c/TemplateMessages.java	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/corext/template/c/TemplateMessages.java	2 Mar 2004 22:32:35 -0000
@@ -12,8 +12,14 @@
 public class TemplateMessages {
 
 	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() {
 	}
 
@@ -22,6 +28,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/corext/textmanipulation/TextManipulationMessages.java
===================================================================
retrieving revision 1.2
diff -u -r1.2 TextManipulationMessages.java
--- src/org/eclipse/cdt/internal/corext/textmanipulation/TextManipulationMessages.java	11 Sep 2003 14:58:30 -0000	1.2
+++ src/org/eclipse/cdt/internal/corext/textmanipulation/TextManipulationMessages.java	2 Mar 2004 22:32:35 -0000
@@ -19,16 +19,25 @@
 
 	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() {
 	}
 
 	public static String getString(String key) {
 		try {
-			return RESOURCE_BUNDLE.getString(key);
+			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/CUIMessages.java
===================================================================
retrieving revision 1.2
diff -u -r1.2 CUIMessages.java
--- src/org/eclipse/cdt/internal/ui/CUIMessages.java	11 Sep 2003 14:58:30 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/CUIMessages.java	2 Mar 2004 22:32:35 -0000
@@ -18,8 +18,15 @@
 
 	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() {
 	}
 
@@ -28,6 +35,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/actions/ActionMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 ActionMessages.java
--- src/org/eclipse/cdt/internal/ui/actions/ActionMessages.java	5 May 2003 14:15:16 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/actions/ActionMessages.java	2 Mar 2004 22:32:35 -0000
@@ -22,7 +22,14 @@
 
 	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() {
 		// no instance
@@ -37,9 +44,11 @@
 	 */	
 	public static String getString(String key) {
 		try {
-			return RESOURCE_BUNDLE.getString(key);
+			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 CViewMessages.java
--- src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java	5 Apr 2003 19:50:43 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/cview/CViewMessages.java	2 Mar 2004 22:32:36 -0000
@@ -18,7 +18,14 @@
 
 	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() {
 	}
@@ -28,6 +35,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.java
===================================================================
retrieving revision 1.2
diff -u -r1.2 CEditorMessages.java
--- src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.java	26 Feb 2004 19:30:35 -0000	1.2
+++ src/org/eclipse/cdt/internal/ui/editor/CEditorMessages.java	2 Mar 2004 22:32:37 -0000
@@ -14,7 +14,14 @@
 	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() 
@@ -36,6 +43,8 @@
 		catch( MissingResourceException e ) 
 		{
 			return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 }
Index: src/org/eclipse/cdt/internal/ui/opentype/OpenTypeMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 OpenTypeMessages.java
--- src/org/eclipse/cdt/internal/ui/opentype/OpenTypeMessages.java	28 Jan 2004 21:23:08 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/opentype/OpenTypeMessages.java	2 Mar 2004 22:32:38 -0000
@@ -18,7 +18,14 @@
 
 	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() {
 	}
@@ -28,6 +35,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 PreferencesMessages.java
--- src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java	28 Jun 2003 19:48:06 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/preferences/PreferencesMessages.java	2 Mar 2004 22:32:38 -0000
@@ -18,7 +18,14 @@
 
 	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() {
 	}
@@ -28,6 +35,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 CSearchMessages.java
--- src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java	16 Jun 2003 17:35:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/search/CSearchMessages.java	2 Mar 2004 22:32:38 -0000
@@ -26,8 +26,15 @@
 public class CSearchMessages {
 	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() {
 	}
 
@@ -36,6 +43,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	/**
Index: src/org/eclipse/cdt/internal/ui/text/link/LinkedPositionMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 LinkedPositionMessages.java
--- src/org/eclipse/cdt/internal/ui/text/link/LinkedPositionMessages.java	26 Jun 2002 20:55:44 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/text/link/LinkedPositionMessages.java	2 Mar 2004 22:32:39 -0000
@@ -12,8 +12,15 @@
 public class LinkedPositionMessages {
 
 	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() {
 	}
 
@@ -22,6 +29,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 NewWizardMessages.java
--- src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.java	27 May 2003 21:33:02 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.java	2 Mar 2004 22:32:39 -0000
@@ -19,8 +19,15 @@
 public class NewWizardMessages {
 
 	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() {
 	}
 		
@@ -29,6 +36,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return '!' + key + '!';
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 	
Index: src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 CElementWorkingSetPage.java
--- src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java	16 Feb 2004 03:28:25 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/workingsets/CElementWorkingSetPage.java	2 Mar 2004 22:32:40 -0000
@@ -60,7 +60,8 @@
 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_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_HEIGHT = 200;
@@ -118,7 +119,7 @@
 
 		//WorkbenchHelp.setHelp(composite, IHelpContextIds.WORKING_SET_RESOURCE_PAGE);		
 		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);
 		label.setLayoutData(data);
 		label.setFont(font);
@@ -136,7 +137,7 @@
 		text.setFocus();
 		
 		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);
 		label.setLayoutData(data);
 		label.setFont(font);
Index: src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetMessages.java
===================================================================
retrieving revision 1.1
diff -u -r1.1 WorkingSetMessages.java
--- src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetMessages.java	16 Feb 2004 03:28:25 -0000	1.1
+++ src/org/eclipse/cdt/internal/ui/workingsets/WorkingSetMessages.java	2 Mar 2004 22:32:40 -0000
@@ -18,8 +18,14 @@
 
 	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() {
 	}
 
@@ -28,6 +34,8 @@
 			return fgResourceBundle.getString(key);
 		} catch (MissingResourceException e) {
 			return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+		} catch (NullPointerException e) {
+			return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
 		}
 	}
 

Back to the top