1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-26 17:53:55 +02:00

[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
This commit is contained in:
David McKnight 2008-02-20 21:48:29 +00:00
parent 785ecdf6b0
commit df73457621
5 changed files with 20 additions and 8 deletions

View file

@ -12,6 +12,7 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - adapted template for daytime example. * 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; package org.eclipse.rse.examples.daytime;
@ -31,7 +32,7 @@ public class Activator extends SystemBasePlugin {
//The shared instance. //The shared instance.
private static Activator plugin; private static Activator plugin;
public static String PLUGIN_ID = "org.eclipse.rse.examples.daytime"; //$NON-NLS-1$
/** /**
* The constructor. * The constructor.
*/ */

View file

@ -7,6 +7,7 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation * 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; package org.eclipse.rse.examples.daytime;
@ -29,6 +30,8 @@ public class DaytimeResources extends NLS {
public static String DaytimeWizard_TestFieldText; public static String DaytimeWizard_TestFieldText;
public static String MSG_CONNECT_FAILED;
static { static {
// load message values from bundle file // load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, DaytimeResources.class); NLS.initializeMessages(BUNDLE_NAME, DaytimeResources.class);

View file

@ -7,6 +7,7 @@
# #
# Contributors: # Contributors:
# Martin Oberhuber (Wind River) - initial API and implementation # 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 # NLS_MESSAGEFORMAT_VAR
@ -19,3 +20,5 @@ Daytime_Connector_Description=The Daytime Connector Service manages connections
Daytime_Resource_Type=daytime resource Daytime_Resource_Type=daytime resource
DaytimeConnectorService_NotAvailable=Daytime service is not available on {0}. DaytimeConnectorService_NotAvailable=Daytime service is not available on {0}.
DaytimeWizard_TestFieldText=This is the Daytime Wizard Test Field. DaytimeWizard_TestFieldText=This is the Daytime Wizard Test Field.
MSG_CONNECT_FAILED = Connect to {0} failed with an unexpected exception

View file

@ -8,11 +8,14 @@
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - initial API and implementation * Martin Oberhuber (Wind River) - initial API and implementation
* David Dykstal (IBM) - [217556] remove service subsystem types * 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; package org.eclipse.rse.examples.daytime.subsystems;
import org.eclipse.core.runtime.IProgressMonitor; 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.swt.widgets.Display;
import org.eclipse.rse.core.events.ISystemResourceChangeEvents; 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.IConnectorService;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.SubSystem; 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.model.DaytimeResource;
import org.eclipse.rse.examples.daytime.service.IDaytimeService; 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.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.model.ISystemRegistryUI; import org.eclipse.rse.ui.model.ISystemRegistryUI;
@ -72,8 +77,8 @@ public class DaytimeSubSystem extends SubSystem {
node.setDaytime(daytime); node.setDaytime(daytime);
return new Object[] { node }; return new Object[] { node };
} catch(Exception e) { } catch(Exception e) {
SystemMessage msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); String msgTxt = NLS.bind(DaytimeResources.MSG_CONNECT_FAILED, getHostName());
msg.makeSubstitution(getHostName(), e); SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, IStatus.ERROR, msgTxt, e);
SystemMessageObject msgobj = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR,this); SystemMessageObject msgobj = new SystemMessageObject(msg, ISystemMessageObject.MSGTYPE_ERROR,this);
return new Object[] { msgobj }; return new Object[] { msgobj };
} }

View file

@ -1785,14 +1785,14 @@ public abstract class SubSystem extends RSEModelObject
else if (exc instanceof java.net.UnknownHostException) else if (exc instanceof java.net.UnknownHostException)
{ {
SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$ SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_UNKNOWNHOST); String msgTxt = NLS.bind(SubSystemResources.MSG_CONNECT_UNKNOWNHOST, hostName);
msg.makeSubstitution(hostName); msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID, IStatus.ERROR, msgTxt, exc);
} }
else else
{ {
SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$ SystemBasePlugin.logError("Connection error", exc); //$NON-NLS-1$
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_CONNECT_FAILED); String msgTxt = NLS.bind(SubSystemResources.MSG_CONNECT_FAILED, hostName);
msg.makeSubstitution(hostName, exc); msg = new SimpleSystemMessage(RSECorePlugin.PLUGIN_ID, IStatus.ERROR, msgTxt, exc);
} }
SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg); SystemMessageDialog msgDlg = new SystemMessageDialog(shell, msg);