|
From: <caw...@us...> - 2006-10-27 21:44:23
|
Revision: 1629
http://svn.sourceforge.net/rubyeclipse/?rev=1629&view=rev
Author: cawilliams
Date: 2006-10-27 14:44:17 -0700 (Fri, 27 Oct 2006)
Log Message:
-----------
apply Shugo Maeda's patch to externalize the surround with begin/rescue action's text
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.java 2006-10-27 21:44:17 UTC (rev 1629)
@@ -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 + '!';
+ }
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/ActionMessages.properties 2006-10-27 21:44:17 UTC (rev 1629)
@@ -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
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2006-10-25 02:08:20 UTC (rev 1628)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/SurroundWithBeginRescueAction.java 2006-10-27 21:44:17 UTC (rev 1629)
@@ -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,
@@ -52,15 +52,13 @@
try {
createChange(selection, new NullProgressMonitor());
} 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 +111,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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|