diff options
author | Dejan Gloszic | 2005-04-12 14:33:58 +0000 |
---|---|---|
committer | Dejan Gloszic | 2005-04-12 14:33:58 +0000 |
commit | 223d868027cd2067af85a4a55e77c8786647517c (patch) | |
tree | 812ad9f487e5c07fe9e9c098f5a37ad57341c054 /org.eclipse.help.appserver | |
parent | 1d8661a2f06ed6aaedfc166ea880d0df65b9b50c (diff) | |
download | eclipse.platform.ua-223d868027cd2067af85a4a55e77c8786647517c.tar.gz eclipse.platform.ua-223d868027cd2067af85a4a55e77c8786647517c.tar.xz eclipse.platform.ua-223d868027cd2067af85a4a55e77c8786647517c.zip |
*** empty log message ***
Diffstat (limited to 'org.eclipse.help.appserver')
4 files changed, 32 insertions, 158 deletions
diff --git a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverPlugin.java b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverPlugin.java index 86646a0b5..e38e207f0 100644 --- a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverPlugin.java +++ b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverPlugin.java @@ -141,7 +141,7 @@ public class AppserverPlugin extends Plugin { if (appServer == null) throw new CoreException(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, - AppserverResources.getString("Appserver.start"), null)); //$NON-NLS-1$ + AppserverResources.Appserver_start, null)); appServer.start(port, hostAddress); } } diff --git a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.java b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.java index b1e6772b8..2d96fa978 100644 --- a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.java +++ b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.java @@ -1,156 +1,35 @@ /******************************************************************************* - * Copyright (c) 2000, 2004 IBM Corporation and others. + * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.help.internal.appserver; -import java.text.*; -import java.util.*; +import org.eclipse.osgi.util.NLS; -import org.eclipse.core.runtime.*; +public final class AppserverResources extends NLS { -/** - * Uses a resource bundle to load strings from a property file. - */ -class AppserverResources { - private static ResourceBundle resBundle; - static { - resBundle = ResourceBundle - .getBundle(AppserverResources.class.getName()); - } - /** - * Resources constructor. - */ - public AppserverResources() { - super(); - } - /** - * Returns a string from a property file - */ - public static String getString(String name) { - try { - return resBundle.getString(name); - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0, String replace1) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0, replace1}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0, - String replace1, String replace2) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0, replace1, - replace2}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0, - String replace1, String replace2, String replace3) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0, replace1, - replace2, replace3}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0, - String replace1, String replace2, String replace3, String replace4) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0, replace1, - replace2, replace3, replace4}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } - - } - /** - * Returns a string from a property file - */ - public static String getString(String name, String replace0, - String replace1, String replace2, String replace3, String replace4, - String replace5) { - try { - String stringFromPropertiesFile = resBundle.getString(name); - stringFromPropertiesFile = MessageFormat.format( - stringFromPropertiesFile, new Object[]{replace0, replace1, - replace2, replace3, replace4, replace5}); - return stringFromPropertiesFile; - } catch (Exception e) { - return name; - } + private static final String BUNDLE_NAME = "org.eclipse.help.internal.appserver.AppserverResources";//$NON-NLS-1$ + private AppserverResources() { + // Do not instantiate } - private static Locale getDefaultLocale() { - String nl = Platform.getNL(); - // sanity test - if (nl == null) - return Locale.getDefault(); + public static String LocalConnectionTest_cannotGetLocalhostName; + public static String Appserver_cannotFindPlugin; + public static String Appserver_cannotFindPath; + public static String Appserver_cannotResolvePath; + public static String Appserver_engineRemove; + public static String Appserver_embeddedStop; + public static String Appserver_addingWebapp; + public static String Appserver_start; - // break the string into tokens to get the Locale object - StringTokenizer locales = new StringTokenizer(nl, "_"); //$NON-NLS-1$ - if (locales.countTokens() == 1) - return new Locale(locales.nextToken(), ""); //$NON-NLS-1$ - else if (locales.countTokens() == 2) - return new Locale(locales.nextToken(), locales.nextToken()); - else if (locales.countTokens() == 3) - return new Locale(locales.nextToken(), locales.nextToken(), locales - .nextToken()); - else - return Locale.getDefault(); + static { + NLS.initializeMessages(BUNDLE_NAME, AppserverResources.class); } -} +}
\ No newline at end of file diff --git a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.properties b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.properties index ea7842414..a5bb8648d 100644 --- a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.properties +++ b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/AppserverResources.properties @@ -4,16 +4,16 @@ # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html -# +# # Contributors: # IBM Corporation - initial API and implementation ############################################################################### -LocalConnectionTest.cannotGetLocalhostName = Host name of local machine cannot be obtained. +LocalConnectionTest_cannotGetLocalhostName = Host name of local machine cannot be obtained. -Appserver.cannotFindPlugin = Location of plug-in {0} cannot be obtained. -Appserver.cannotFindPath = Location of path {1} in plug-in {0} cannot be obtained. -Appserver.cannotResolvePath = Location of path {1} in plug-in {0} cannot be resolved. -Appserver.engineRemove = Exception occurred during removing an engine from embedded application server. -Appserver.embeddedStop = Exception occurred during stopping embedded server. -Appserver.addingWebapp = Exception occurred adding webapp {0} based at {1}. -Appserver.start = Exception occurred starting application server. +Appserver_cannotFindPlugin = Location of plug-in {0} cannot be obtained. +Appserver_cannotFindPath = Location of path {1} in plug-in {0} cannot be obtained. +Appserver_cannotResolvePath = Location of path {1} in plug-in {0} cannot be resolved. +Appserver_engineRemove = Exception occurred during removing an engine from embedded application server. +Appserver_embeddedStop = Exception occurred during stopping embedded server. +Appserver_addingWebapp = Exception occurred adding webapp {0} based at {1}. +Appserver_start = Exception occurred starting application server. diff --git a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/WebappManager.java b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/WebappManager.java index 19c7fc32e..029d1bf7d 100644 --- a/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/WebappManager.java +++ b/org.eclipse.help.appserver/src/org/eclipse/help/internal/appserver/WebappManager.java @@ -14,6 +14,7 @@ import java.io.*; import java.net.*; import org.eclipse.core.runtime.*; +import org.eclipse.osgi.util.NLS; import org.osgi.framework.*; /** @@ -110,9 +111,7 @@ public class WebappManager { Bundle bundle = Platform.getBundle(pluginId); if (bundle == null) { throw new CoreException(new Status(IStatus.ERROR, - AppserverPlugin.PLUGIN_ID, IStatus.OK, AppserverResources - .getString("Appserver.cannotFindPlugin", //$NON-NLS-1$ - pluginId), null)); + AppserverPlugin.PLUGIN_ID, IStatus.OK, NLS.bind("Appserver.cannotFindPlugin", pluginId), null)); } // Note: we just look for one webapp directory. @@ -120,9 +119,7 @@ public class WebappManager { URL webappURL = Platform.find(bundle, path); if (webappURL == null) { throw new CoreException(new Status(IStatus.ERROR, - AppserverPlugin.PLUGIN_ID, IStatus.OK, AppserverResources - .getString("Appserver.cannotFindPath", //$NON-NLS-1$ - pluginId, path.toOSString()), null)); + AppserverPlugin.PLUGIN_ID, IStatus.OK, NLS.bind("Appserver.cannotFindPath", pluginId, path.toOSString()), null)); } try { @@ -131,9 +128,7 @@ public class WebappManager { return new Path(webappLocation); } catch (IOException ioe) { throw new CoreException(new Status(IStatus.ERROR, - AppserverPlugin.PLUGIN_ID, IStatus.OK, AppserverResources - .getString("Appserver.cannotResolvePath", //$NON-NLS-1$ - pluginId, path.toOSString()), ioe)); + AppserverPlugin.PLUGIN_ID, IStatus.OK, NLS.bind("Appserver.cannotResolvePath", pluginId, path.toOSString()), ioe)); } } |