Hi,

I read FIXME comments in SurroundWithBeginRescueAction and externalized
strings in it.
Please check the attached patch.

Shugo
=== 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
==================================================================
--- 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
  (revision 25)
+++ 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
  (revision 26)
@@ -0,0 +1,3 @@
+SurroundWithBeginRescueAction.label=Surround with begin...rescue
+SurroundWithBeginRescueAction.error=Error occurred while surrounding code with 
begin..rescue block
+SurroundWithBeginRescueAction.dialog.title=Surround with begin...rescue
=== org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
==================================================================
--- org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 
 (revision 25)
+++ org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 
 (revision 26)
@@ -0,0 +1,22 @@
+package org.rubypeople.rdt.ui.actions;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ActionMessages {
+       private static final String BUNDLE_NAME = 
"org.rubypeople.rdt.ui.actions.ActionMessages"; //$NON-NLS-1$
+
+       private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+                       .getBundle(BUNDLE_NAME);
+
+       private ActionMessages() {
+       }
+
+       public static String getString(String key) {
+               try {
+                       return RESOURCE_BUNDLE.getString(key);
+               } catch (MissingResourceException e) {
+                       return '!' + key + '!';
+               }
+       }
+}
=== 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
==================================================================
--- 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
  (revision 25)
+++ 
org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
  (revision 26)
@@ -41,7 +41,7 @@
     public SurroundWithBeginRescueAction(RubyEditor editor) {
         super(editor.getEditorSite());
 
-        setText("Surround with begin...rescue");
+        
setText(ActionMessages.getString("SurroundWithBeginRescueAction.label")); 
//$NON-NLS-1$
         fEditor = editor;
         setEnabled((fEditor != null && 
SelectionConverter.getInputAsRubyScript(fEditor) != null));
         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
@@ -54,13 +54,13 @@
         } catch (CoreException e) {
             // FIXME Localize! Extract into ResourceBundle
             ExceptionHandler.handle(e, getDialogTitle(),
-                    "Error occurred while surrounding code with begin..rescue 
block");
+                    
ActionMessages.getString("SurroundWithBeginRescueAction.error")); //$NON-NLS-1$
         }
     }
 
     private static String getDialogTitle() {
         // FIXME Localize! Extract into ResourceBundle
-        return "Surround with begin...rescue";
+        return 
ActionMessages.getString("SurroundWithBeginRescueAction.dialog.title"); 
//$NON-NLS-1$
     }
 
     private IFile getFile() {
@@ -113,19 +113,19 @@
                 Indents.getIndentWidth(options));
 
         StringBuffer text = new StringBuffer();
-        text.append("begin");
+        text.append("begin"); //$NON-NLS-1$
         text.append(lineDelimiter);
         text.append(Indents.createIndentString(indentationUnits + 1, options));
         text.append(originalText);
         text.append(lineDelimiter);
         text.append(Indents.createIndentString(indentationUnits, options));
-        text.append("rescue StandardError => e");
+        text.append("rescue StandardError => e"); //$NON-NLS-1$
         text.append(lineDelimiter);
         text.append(Indents.createIndentString(indentationUnits + 1, options));
-        text.append("puts e");
+        text.append("puts e"); //$NON-NLS-1$
         text.append(lineDelimiter);
         text.append(Indents.createIndentString(indentationUnits, options));
-        text.append("end");
+        text.append("end"); //$NON-NLS-1$
         text.append(lineDelimiter);
         text.append(Indents.createIndentString(indentationUnits, options));
         return text.toString();
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rubyeclipse-development mailing list
Rubyeclipse-development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rubyeclipse-development

Reply via email to