Author: dmaliarevich
Date: 2010-02-01 06:49:49 -0500 (Mon, 01 Feb 2010)
New Revision: 20043
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.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, JsfView template and junit were updated.
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-01
09:24:15 UTC (rev 20042)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfView.java 2010-02-01
11:49:49 UTC (rev 20043)
@@ -80,17 +80,19 @@
* These expressions are parsed before template creating
* in VpeVisualDomBuilder, f:view template has already got parsed el.
*
- * 1.2 If there is a default locale specified - use it in any case,
- * otherwise get the locale from the attribute.
+ * 1.2 If there is a defined locale - use it in any case,
+ * otherwise get the default locale from the faces-config.
*/
- String defaultLocaleString = MainLocaleProvider.getInstance().getLocaleString();
- if (ComponentUtil.isNotBlank(defaultLocaleString)) {
- localeString = defaultLocaleString;
+ String localeAttribute = sourceElement.getAttribute(ATTR_LOCALE);
+ String defaultLocaleString = Constants.EMPTY;
+ if (ComponentUtil.isNotBlank(localeAttribute)) {
+ localeString = localeAttribute;
+ } else if (ComponentUtil
+ .isNotBlank(defaultLocaleString = MainLocaleProvider
+ .getInstance().getLocaleString())) {
+ localeString = defaultLocaleString;
} else {
- String localeAttribute = sourceElement.getAttribute(ATTR_LOCALE);
- if (ComponentUtil.isNotBlank(localeAttribute)) {
- localeString = localeAttribute;
- }
+ localeString = Constants.EMPTY;
}
/*
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-01
09:24:15 UTC (rev 20042)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/TestFViewLocaleAttribute_JBIDE5218.java 2010-02-01
11:49:49 UTC (rev 20043)
@@ -97,7 +97,7 @@
nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be should be
in 'de' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be should be
in 'de' locale", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
closeEditors();
}
@@ -115,11 +115,11 @@
nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT0_ID);
String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in
'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be in
'en' locale", HELLO_EN.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
localeText = doc.getElementById(LOCALE_TEXT1_ID);
localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in
'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be in
'de' locale", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
localeText = doc.getElementById(LOCALE_TEXT2_ID);
localizedText = getLocalizedText(localeText);
@@ -127,7 +127,7 @@
localeText = doc.getElementById(LOCALE_TEXT_ID);
localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in
'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be in
'en_GB' locale", HELLO_EN_GB.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
closeEditors();
}
@@ -146,7 +146,7 @@
nsIDOMDocument doc = controller.getXulRunnerEditor().getDOMDocument();
nsIDOMElement localeText = doc.getElementById(LOCALE_TEXT_ID);
String localizedText = getLocalizedText(localeText);
- assertTrue("Text is '"+localizedText+"', but should be in
'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be in
'de' locale", HELLO2_DE.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
/*
* Change the locale
*/
@@ -164,7 +164,7 @@
/*
* Check the new localized message.
*/
- assertTrue("Text is '"+localizedText+"', but should be in
'en_US' locale", HELLO_EN_US.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
+ assertTrue("Text is '"+localizedText+"', but should be in
'en_GB' locale", HELLO_EN_GB.equalsIgnoreCase(localizedText)); //$NON-NLS-1$
//$NON-NLS-2$
closeEditors();
}