Author: dmaliarevich
Date: 2010-02-22 04:56:44 -0500 (Mon, 22 Feb 2010)
New Revision: 20410
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/ComponentUtil.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5218, locale creation in JUnit was fixed.
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2010-02-22
04:35:47 UTC (rev 20409)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2010-02-22
09:56:44 UTC (rev 20410)
@@ -98,7 +98,7 @@
/*
* 2. Create Locale object from locale string.
*/
- locale = createLocale(localeString);
+ locale = ComponentUtil.createLocale(localeString);
/*
* 3. Get bundles for this Locale and Refresh the page.
@@ -121,27 +121,6 @@
}
/**
- * Creates the locale.
- * <p>If the locale string could be parsed into language and country -
- * creates Locale for this arguments.
- * <p> By default - locale for empty string is created.
- *
- * @param localeString the locale string
- * @return Locale object
- */
- Locale createLocale(String localeString) {
- Locale newLocale = null;
- if (localeString.length() == 2) {
- newLocale = new Locale(localeString);
- } else if ((localeString.length() == 5) && (localeString.indexOf("_")
== 2)) { //$NON-NLS-1$
- newLocale = new Locale(localeString.substring(0, 2), localeString.substring(3));
- } else {
- newLocale = new Locale(Constants.EMPTY);
- }
- return newLocale;
- }
-
- /**
* Gets the children.
*
* @param sourceElement the source element
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/ComponentUtil.java 2010-02-22
04:35:47 UTC (rev 20409)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/ComponentUtil.java 2010-02-22
09:56:44 UTC (rev 20410)
@@ -12,9 +12,11 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Locale;
import org.jboss.tools.vpe.editor.bundle.BundleMap;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Attr;
@@ -182,4 +184,29 @@
public static boolean isNotBlank(String value) {
return !isBlank(value);
}
+
+ /**
+ * Creates the locale.
+ * <p>If the locale string could be parsed into language and country -
+ * creates Locale for this arguments.
+ * <p> By default - locale for empty string is created.
+ *
+ * @param localeString the locale string
+ * @return Locale object
+ */
+ public static Locale createLocale(String localeString) {
+ Locale newLocale = null;
+ if (null != localeString) {
+ if (localeString.length() == 2) {
+ newLocale = new Locale(localeString);
+ } else if ((localeString.length() == 5) &&
(localeString.indexOf("_") == 2)) { //$NON-NLS-1$
+ newLocale = new Locale(localeString.substring(0, 2), localeString.substring(3));
+ } else {
+ newLocale = new Locale(Constants.EMPTY);
+ }
+ } else {
+ newLocale = new Locale(Constants.EMPTY);
+ }
+ return newLocale;
+ }
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2010-02-22
04:35:47 UTC (rev 20409)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2010-02-22
09:56:44 UTC (rev 20410)
@@ -22,6 +22,7 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.vpe.VpePlugin;
@@ -353,8 +354,9 @@
ClassLoader classLoader = new URLClassLoader(urls, ClassLoader
.getSystemClassLoader());
+ Locale locale = ComponentUtil.createLocale(localeName);
ResourceBundle bundle = ResourceBundle.getBundle(bundleName,
- new Locale(localeName), classLoader);
+ locale, classLoader);
String bundleText = bundle.getString(bundleKey);
assertNotNull(bundleText);
assertTrue(