Author: sflanigan
Date: 2009-04-07 01:56:07 -0400 (Tue, 07 Apr 2009)
New Revision: 14535
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.properties
Log:
JBIDE-3557 Externalise English strings - converted RegisterServerContext/Messages to
new-style Eclipse message bundle
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/Messages.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/Messages.java 2009-04-07
05:50:28 UTC (rev 14534)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/Messages.java 2009-04-07
05:56:07 UTC (rev 14535)
@@ -1,22 +1,20 @@
-package org.jboss.tools.jst.web.context;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class Messages {
- private static final String BUNDLE_NAME =
"org.jboss.tools.jst.web.context.RegisterServerContext"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
+package org.jboss.tools.jst.web.context;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class Messages extends NLS {
+
+ private static final String BUNDLE_NAME =
"org.jboss.tools.jst.web.context.RegisterServerContext";//$NON-NLS-1$
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ public static String ERR_APP_NAME_IS_NOT_SPECIFIED;
+ public static String ERR_SERVLET_VERSION_IS_NOT_SET;
+ public static String ERR_SERVLET_VERSION_IS_NOT_VALID;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java 2009-04-07
05:50:28 UTC (rev 14534)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.java 2009-04-07
05:56:07 UTC (rev 14535)
@@ -134,19 +134,20 @@
return applicationName;
}
+ @SuppressWarnings("restriction")
public String getErrorMessage() {
if(runtimeName == null || runtimeName.length() == 0) return
WebUIMessages.RUNTIME_IS_REQUIRED;
if(runtime == null) return WebUIMessages.SPECIFIED_RUNTIME_DOESNOT_EXIST;
if(!isEnabled()) {
if(servletVersion != null && servletVersion.length() == 0) {
- return Messages.getString("ERR_SERVLET_VERSION_IS_NOT_SET"); //$NON-NLS-1$
+ return Messages.ERR_SERVLET_VERSION_IS_NOT_SET;
}
return null;
}
if(applicationName == null || applicationName.length() == 0) {
- return Messages.getString("ERR_APP_NAME_IS_NOT_SPECIFIED");
//$NON-NLS-1$
+ return Messages.ERR_APP_NAME_IS_NOT_SPECIFIED;
}
if(true) {
@@ -154,7 +155,7 @@
if(contextRootError != null) return contextRootError;
for (int i = 0; i < targetServers.length; i++) {
if(RegistrationHelper.isRegistered(applicationName, targetServers[i])) {
- return NLS.bind(WebUIMessages.APPLICATION_IS_ALREADY_REGISTERED, applicationName,
targetServers[i].getName()); //$NON-NLS-2$
+ return NLS.bind(WebUIMessages.APPLICATION_IS_ALREADY_REGISTERED, applicationName,
targetServers[i].getName());
}
if(this.project != null /*&& !this.project.exists()*/ &&
servletVersion != null && servletVersion.length() > 0) {
if(project.exists() && RegistrationHelper.isRegistered(project)) {
@@ -170,9 +171,9 @@
}
}
if(servletVersion != null && servletVersion.length() == 0) {
- return Messages.getString("ERR_SERVLET_VERSION_IS_NOT_SET"); //$NON-NLS-1$
+ return Messages.ERR_SERVLET_VERSION_IS_NOT_SET;
} else if(!checkServletVersionFormat()) {
- return Messages.getString("ERR_SERVLET_VERSION_IS_NOT_VALID");
//$NON-NLS-1$
+ return Messages.ERR_SERVLET_VERSION_IS_NOT_VALID;
}
return null;
}
@@ -182,7 +183,7 @@
boolean checkServletVersionFormat() {
if(servletVersion == null || servletVersion.length() == 0) return true;
- StringTokenizer st = new StringTokenizer(servletVersion, ".");
+ StringTokenizer st = new StringTokenizer(servletVersion, "."); //$NON-NLS-1$
if(st.countTokens() < 2 || st.countTokens() > 3) return false;
while(st.hasMoreTokens()) {
String t = st.nextToken().trim();
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.properties
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.properties 2009-04-07
05:50:28 UTC (rev 14534)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/context/RegisterServerContext.properties 2009-04-07
05:56:07 UTC (rev 14535)
@@ -2,9 +2,5 @@
# Next 3 messages are used in org.jboss.tools.jst.web.context.RegisterServerContext
#
ERR_APP_NAME_IS_NOT_SPECIFIED=Application Name is not specified.
-
-# START NON-TRANSLATABLE
-# END NON-TRANSLATABLE
-
ERR_SERVLET_VERSION_IS_NOT_SET=Servlet version is not specified.
ERR_SERVLET_VERSION_IS_NOT_VALID=Servlet version is not valid.