Author: mareshkau
Date: 2010-01-15 13:17:03 -0500 (Fri, 15 Jan 2010)
New Revision: 19783
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/5639/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/5639/messageResolutionTest.jsp
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/MessageResolutionInPreviewTabTest.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/WEB-INF/faces-config.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/plugin.xml
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5639 , message resolution has been resolved on
Preview
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/WEB-INF/faces-config.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/WEB-INF/faces-config.xml 2010-01-15
17:39:41 UTC (rev 19782)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/WEB-INF/faces-config.xml 2010-01-15
18:17:03 UTC (rev 19783)
@@ -1,30 +1,32 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
-
xmlns:xi="http://www.w3.org/2001/XInclude"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
- <managed-bean>
- <description>User Name Bean</description>
- <managed-bean-name>user</managed-bean-name>
- <managed-bean-class>demo.User</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>name</property-name>
- <property-class>java.lang.String</property-class>
- <value/>
- </managed-property>
- </managed-bean>
- <navigation-rule>
- <from-view-id>/pages/inputUserName.jsp</from-view-id>
- <navigation-case>
- <from-outcome>hello</from-outcome>
- <to-view-id>/pages/hello.jsp</to-view-id>
- </navigation-case>
- </navigation-rule>
- <application>
- <locale-config>
- <default-locale>de</default-locale>
- </locale-config>
- </application>
- <factory/>
- <lifecycle/>
-</faces-config>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
+
xmlns:xi="http://www.w3.org/2001/XInclude"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ <managed-bean>
+ <description>User Name Bean</description>
+ <managed-bean-name>user</managed-bean-name>
+ <managed-bean-class>demo.User</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ <managed-property>
+ <property-name>name</property-name>
+ <property-class>java.lang.String</property-class>
+ <value/>
+ </managed-property>
+ </managed-bean>
+ <navigation-rule>
+ <from-view-id>/pages/inputUserName.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>hello</from-outcome>
+ <to-view-id>/pages/hello.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <application>
+ <resource-bundle>
+ <base-name>demo.Messages</base-name>
+ <var>msg</var>
+ </resource-bundle>
+ <locale-config>
+ <default-locale>de</default-locale>
+ </locale-config>
+ </application>
+</faces-config>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/5639/messageResolutionTest.jsp
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/5639/messageResolutionTest.jsp
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/i18nTest/WebContent/pages/JBIDE/5639/messageResolutionTest.jsp 2010-01-15
18:17:03 UTC (rev 19783)
@@ -0,0 +1,4 @@
+#{msg.hello_message}
+
+
+
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-01-15
17:39:41 UTC (rev 19782)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2010-01-15
18:17:03 UTC (rev 19783)
@@ -67,6 +67,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4509Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4510Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE4534Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.MessageResolutionInPreviewTabTest;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnInJarPackageFragment_JBIDE5682;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnJsf20Test_JBIDE5382;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.TaglibXMLUnformatedDTD_JBIDE5642;
@@ -190,6 +191,7 @@
suite.addTestSuite(TestOpenOnForXhtmlFiles_JBIDE5577.class);
suite.addTestSuite(TaglibXMLUnformatedDTD_JBIDE5642.class);
suite.addTestSuite(OpenOnInJarPackageFragment_JBIDE5682.class);
+ suite.addTestSuite(MessageResolutionInPreviewTabTest.class);
// $JUnit-END$
// added by Max Areshkau
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/MessageResolutionInPreviewTabTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/MessageResolutionInPreviewTabTest.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/MessageResolutionInPreviewTabTest.java 2010-01-15
18:17:03 UTC (rev 19783)
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jsf.vpe.jsf.test.jbide;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.mozilla.MozillaPreview;
+import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
+import org.mozilla.interfaces.nsIDOMElement;
+
+/**
+ *
https://jira.jboss.org/jira/browse/JBIDE-5639
+ *
+ * @author mareshkau
+ *
+ */
+public class MessageResolutionInPreviewTabTest extends VpeTest {
+
+ public MessageResolutionInPreviewTabTest(String name) {
+ super(name);
+ }
+
+ public void testMessageResolutionInPreviewTab() throws Throwable {
+ setException(null);
+ IFile file = (IFile)
TestUtil.getComponentPath("JBIDE/5639/messageResolutionTest.jsp", //$NON-NLS-1$
+ JsfAllTests.IMPORT_I18N_PROJECT_NAME);
+ IEditorInput input = new FileEditorInput(file);
+ assertNotNull("Editor input is null", input); //$NON-NLS-1$
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+ part.pageChange(part.getPreviewIndex());
+ part.setPreviewIndex(2);
+
+ MozillaPreview mozillaPreview = (MozillaPreview)
part.getVisualEditor().getPreviewWebBrowser();
+ //here we wait for preview initialization, but it's should be less then 1 second
+ long end = System.currentTimeMillis()+1000;
+ while(mozillaPreview.getContentArea()==null) {
+ if (!Display.getCurrent().readAndDispatch()) {
+ Display.getCurrent().sleep();
+ assertEquals("The preview initialization to long", true,
end>System.currentTimeMillis()); //$NON-NLS-1$
+ }
+ }
+ nsIDOMElement contentArea = mozillaPreview.getContentArea();
+ assertEquals("The Message Should be from resource bundles","Guten
Tag!",contentArea.getFirstChild().getFirstChild().getNodeValue().trim());
//$NON-NLS-1$ //$NON-NLS-2$
+ if(getException()!=null) {
+ throw getException();
+ }
+ }
+
+}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-01-15
17:39:41 UTC (rev 19782)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2010-01-15
18:17:03 UTC (rev 19783)
@@ -204,6 +204,7 @@
}
}
+ @Override
public void pageChange(int newPageIndex) {
selectedPageIndex = newPageIndex;
if (visualEditor != null) {
@@ -214,7 +215,7 @@
visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
} else if (newPageIndex == sourceIndex)
visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
- else if (newPageIndex == previewIndex) {
+ else if (newPageIndex == getPreviewIndex()) {
if (visualEditor.getPreviewWebBrowser() == null) {
visualEditor.createPreviewBrowser();
}
@@ -476,8 +477,8 @@
// Add tab contain default web-browser
try {
if (visualEditor != null) {
- previewIndex = addPage(visualEditor, getEditorInput());
- setPageText(previewIndex,
+ setPreviewIndex(addPage(visualEditor, getEditorInput()));
+ setPageText(getPreviewIndex(),
JSPEditorMessages.JSPMultiPageEditor_TabLabel_Preview);
setPartName(visualEditor.getTitle());
}
@@ -800,6 +801,20 @@
JspEditorPlugin.getPluginLog().logError(e);
}
}
+
+ /**
+ * @return the previewIndex
+ */
+ public int getPreviewIndex() {
+ return previewIndex;
+ }
+
+ /**
+ * @param previewIndex the previewIndex to set
+ */
+ public void setPreviewIndex(int previewIndex) {
+ this.previewIndex = previewIndex;
+ }
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/plugin.xml 2010-01-15 17:39:41 UTC (rev
19782)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/plugin.xml 2010-01-15 18:17:03 UTC (rev
19783)
@@ -47,7 +47,9 @@
<axis path="/facelet-taglib/tag/handler-class">
</axis>
<axis path="/facelet-taglib/library-class">
- </axis>
+ </axis>
+ <axis path="/facelet-taglib/attribute/type" >
+ </axis>
</partitionType>
</contentType>
</hyperlinkPartitioner>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2010-01-15
17:39:41 UTC (rev 19782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/bundle/BundleMap.java 2010-01-15
18:17:03 UTC (rev 19783)
@@ -70,7 +70,7 @@
private BundleEntry[] bundles = new BundleEntry[0];
private Map<String,UsedKey> usedKeys = new HashMap<String,UsedKey>();
- boolean isShowBundleUsageAsEL =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
+ boolean showBundleUsageAsEL =
JspEditorPlugin.getDefault().getPreferenceStore().getBoolean(
IVpePreferencesPage.SHOW_RESOURCE_BUNDLES_USAGE_AS_EL);
XModelTreeListener modelListener = new ML();
@@ -141,7 +141,7 @@
}
public boolean isShowBundleUsageAsEL() {
- return isShowBundleUsageAsEL;
+ return showBundleUsageAsEL;
}
private static final String[] JSF_PROJECT_NATURES = {
@@ -398,7 +398,7 @@
}
public String getBundleValue(String name){
- if(isShowBundleUsageAsEL) {
+ if(showBundleUsageAsEL) {
return name;
}
List<ELInstance> is = parseJSFExpression(name);
@@ -506,8 +506,8 @@
}
public void updateShowBundleUsageAsEL(boolean showBundlesAsEL) {
- if(isShowBundleUsageAsEL != showBundlesAsEL) {
- isShowBundleUsageAsEL = showBundlesAsEL;
+ if(showBundleUsageAsEL != showBundlesAsEL) {
+ showBundleUsageAsEL = showBundlesAsEL;
refresh();
}
}
@@ -574,4 +574,11 @@
}
+ /**
+ * @param showBundleUsageAsEL the showBundleUsageAsEL to set
+ */
+ public void setShowBundleUsageAsEL(boolean showBundleUsageAsEL) {
+ this.showBundleUsageAsEL = showBundleUsageAsEL;
+ }
+
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2010-01-15
17:39:41 UTC (rev 19782)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2010-01-15
18:17:03 UTC (rev 19783)
@@ -120,6 +120,10 @@
public void buildDom() {
BundleMap bundle = new BundleMap();
bundle.init(getSourceEditor());
+ //Fix for
https://jira.jboss.org/jira/browse/JBIDE-5639 - mareshkau
+ // in preview should be closer to view in browser. So all
+ // bundles should be showed as messages, no as el.
+ bundle.setShowBundleUsageAsEL(false);
setPageContext(new VpePageContext(bundle, getEditPart()));