From df73457621b36498c2c7ea2969042dab873184ed Mon Sep 17 00:00:00 2001 From: David McKnight Date: Wed, 20 Feb 2008 21:48:29 +0000 Subject: [PATCH] [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible -this is phase 1...still need to get rid of duplicate messages --- .../org/eclipse/rse/examples/daytime/Activator.java | 3 ++- .../rse/examples/daytime/DaytimeResources.java | 3 +++ .../rse/examples/daytime/DaytimeResources.properties | 3 +++ .../examples/daytime/subsystems/DaytimeSubSystem.java | 11 ++++++++--- .../org/eclipse/rse/core/subsystems/SubSystem.java | 8 ++++---- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/Activator.java b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/Activator.java index 24a0f513118..86cbe6522d5 100644 --- a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/Activator.java +++ b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/Activator.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - adapted template for daytime example. + * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible ********************************************************************************/ package org.eclipse.rse.examples.daytime; @@ -31,7 +32,7 @@ public class Activator extends SystemBasePlugin { //The shared instance. private static Activator plugin; - + public static String PLUGIN_ID = "org.eclipse.rse.examples.daytime"; //$NON-NLS-1$ /** * The constructor. */ diff --git a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.java b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.java index f9afda11b97..292e51c53a4 100644 --- a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.java +++ b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.java @@ -7,6 +7,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - initial API and implementation + * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible *******************************************************************************/ package org.eclipse.rse.examples.daytime; @@ -29,6 +30,8 @@ public class DaytimeResources extends NLS { public static String DaytimeWizard_TestFieldText; + public static String MSG_CONNECT_FAILED; + static { // load message values from bundle file NLS.initializeMessages(BUNDLE_NAME, DaytimeResources.class); diff --git a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.properties b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.properties index c571a4a6eab..0317124430a 100644 --- a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.properties +++ b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/DaytimeResources.properties @@ -7,6 +7,7 @@ # # Contributors: # Martin Oberhuber (Wind River) - initial API and implementation +# David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible ################################################################################ # NLS_MESSAGEFORMAT_VAR @@ -19,3 +20,5 @@ Daytime_Connector_Description=The Daytime Connector Service manages connections Daytime_Resource_Type=daytime resource DaytimeConnectorService_NotAvailable=Daytime service is not available on {0}. DaytimeWizard_TestFieldText=This is the Daytime Wizard Test Field. + +MSG_CONNECT_FAILED = Connect to {0} failed with an unexpected exception diff --git a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/subsystems/DaytimeSubSystem.java b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/subsystems/DaytimeSubSystem.java index 18f2c3b45bc..a856e533f4e 100644 --- a/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/subsystems/DaytimeSubSystem.java +++ b/rse/examples/org.eclipse.rse.examples.daytime/src/org/eclipse/rse/examples/daytime/subsystems/DaytimeSubSystem.java @@ -8,11 +8,14 @@ * Contributors: * Martin Oberhuber (Wind River) - initial API and implementation * David Dykstal (IBM) - [217556] remove service subsystem types + * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible *******************************************************************************/ package org.eclipse.rse.examples.daytime.subsystems; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Display; import org.eclipse.rse.core.events.ISystemResourceChangeEvents; @@ -23,10 +26,12 @@ import org.eclipse.rse.core.model.SystemMessageObject; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.SubSystem; +import org.eclipse.rse.examples.daytime.Activator; +import org.eclipse.rse.examples.daytime.DaytimeResources; import org.eclipse.rse.examples.daytime.model.DaytimeResource; import org.eclipse.rse.examples.daytime.service.IDaytimeService; +import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage; -import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.model.ISystemRegistryUI; @@ -72,8 +77,8 @@ public class DaytimeSubSystem extends SubSystem { node.setDaytime(daytime); return new Object[] { node }; } catch(Exception e) { - SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); - msg.makeSubstitution(getHostName(), e); + String msgTxt = NLS.bind(DaytimeResources.MSG_CONNECT_FAILED, getHostName()); + SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt, e); SystemMessageObject msgobj = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR,this); return new Object[] { msgobj }; } diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java index 056958638f7..a8eb64a5aa8 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java @@ -1785,14 +1785,14 @@ public abstract class SubSystem extends RSEModelObject else if (exc instanceof java.net.UnknownHostException) { SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$ - msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST); - msg.makeSubstitution(hostName); + String msgTxt = NLS.bind(SubSystemResources.MSG_CONNECT_UNKNOWNHOST, hostName); + msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID, IStatus.ERROR, msgTxt, exc); } else { SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$ - msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); - msg.makeSubstitution(hostName, exc); + String msgTxt = NLS.bind(SubSystemResources.MSG_CONNECT_FAILED, hostName); + msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID, IStatus.ERROR, msgTxt, exc); } SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);