Author: yradtsevich
Date: 2011-09-28 06:41:10 -0400 (Wed, 28 Sep 2011)
New Revision: 35109
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/templates/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/templates/main-web-content2.xhtml
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.eclipse.wst.common.component
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllImportantTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9753 : multiple content web roots seem to confuse
VPE
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2011-09-28
10:32:56 UTC (rev 35108)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2011-09-28
10:41:10 UTC (rev 35109)
@@ -270,16 +270,16 @@
.replaceFirst(
"^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
Constants.EMPTY); //$NON-NLS-1$
- IFile file = null;
+ IFile baseFile = null;
if (pageContext.getVisualBuilder().getCurrentIncludeInfo() != null
&&(pageContext.getVisualBuilder().getCurrentIncludeInfo().getStorage()
instanceof IFile)) {
- file = (IFile) pageContext.getVisualBuilder().getCurrentIncludeInfo()
+ baseFile = (IFile) pageContext.getVisualBuilder().getCurrentIncludeInfo()
.getStorage();
}
- if (file == null)
+ if (baseFile == null)
return resolvedValue;
- resolvedValue = ElServiceUtil.replaceEl(file, resolvedValue);
+ resolvedValue = ElServiceUtil.replaceEl(baseFile, resolvedValue);
URI uri = null;
try {
@@ -291,9 +291,14 @@
&& (uri.isAbsolute() || (new File(resolvedValue)).exists()))
return resolvedValue;
- return Constants.FILE_PREFIX
- + FileUtil.getFile(resolvedValue, file).getLocation()
- .toPortableString();
+
+
+ IFile resolvedFile = FileUtil.getFile(resolvedValue, baseFile);
+ if (resolvedFile != null ) {
+ return Constants.FILE_PREFIX + resolvedFile.getLocation().toPortableString();
+ } else {
+ return resolvedValue;
+ }
}
/**
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.eclipse.wst.common.component
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.eclipse.wst.common.component 2011-09-28
10:32:56 UTC (rev 35108)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/.settings/org.eclipse.wst.common.component 2011-09-28
10:41:10 UTC (rev 35109)
@@ -2,6 +2,7 @@
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="jsf2Test">
<wb-resource deploy-path="/" source-path="/WebContent"/>
+<wb-resource deploy-path="/" source-path="/WebContent2"/>
<wb-resource deploy-path="/WEB-INF/classes"
source-path="/JavaSource"/>
<property name="java-output-path" value="build/classes"/>
<property name="context-root" value="jsf2Test"/>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml 2011-09-28
10:41:10 UTC (rev 35109)
@@ -0,0 +1,14 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition template="/templates/main-web-content2.xhtml"
id="jbide9753">
+ <ui:define name="body">
+ Welcome To RichFaces 4.x Demo
+ </ui:define>
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/9753/welcome.xhtml.xml 2011-09-28
10:41:10 UTC (rev 35109)
@@ -0,0 +1,211 @@
+<tests>
+ <test id="jbide9753">
+
+ <DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV STYLE="display: none; -moz-user-modify: read-only;">
+ </DIV>
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV STYLE="display: none; -moz-user-modify: read-only;">
+ </DIV>
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+ <SPAN CLASS="vpe-text" STYLE="-moz-user-modify:
read-only;">
+ </SPAN>
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV STYLE="display: none; -moz-user-modify: read-only;">
+ <DIV STYLE="-moz-user-modify: read-only;">
+ </DIV>
+ </DIV>
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <TABLE CELLSPACING="0" CELLPADDING="0"
BORDER="0"
+ CLASS="rich-page #{cc.attrs.pageClass}"
STYLE="-moz-user-modify: read-only;">
+ <TBODY STYLE="-moz-user-modify: read-only;">
+ <TR STYLE="-moz-user-modify: read-only;">
+ <TD CLASS="header_bg" STYLE="-moz-user-modify:
read-only;">
+ <DIV CLASS="header_content rich-page-header
#{cc.attrs.headerClass}" STYLE="-moz-user-modify: read-only;">
+ <SPAN STYLE="display: none; -moz-user-modify:
read-only;">
+ </SPAN>
+ </DIV>
+ </TD>
+ </TR>
+ <TR STYLE="-moz-user-modify: read-only;">
+ <TD WIDTH="100%" HEIGHT="100%"
CLASS="bg_tabbody"
+ STYLE="-moz-user-modify: read-only;">
+ <TABLE WIDTH="100%" HEIGHT="100%"
CELLSPACING="0"
+ CELLPADDING="0" BORDER="0"
+ CLASS="rich-page-content #{cc.attrs.contentClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <TBODY STYLE="-moz-user-modify: read-only;">
+ <TR STYLE="-moz-user-modify: read-only;">
+ <TD CLASS="menu_col rich-page-sidebar
#{cc.attrs.sidebarClass}" STYLE="-moz-user-modify: read-only;">
+ <DIV CLASS="menu_width spacer"
STYLE="-moz-user-modify: read-only;">
+ <BR VPE:PSEUDO-ELEMENT="yes"
+ STYLE="font-style: italic; color: green; -moz-user-modify:
read-only;" />
+
+ </DIV>
+ <SPAN STYLE="-moz-user-modify: read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes"
+ STYLE="-moz-user-modify: read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes"
+ STYLE="-moz-user-modify: read-only;">
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV
+ STYLE="display: none; -moz-user-modify:
read-only;">
+ </DIV>
+ <DIV STYLE="-moz-user-modify: read-only;">
+ <DIV VPE:INCLUDE-ELEMENT="yes"
+ STYLE="-moz-user-modify: read-only;">
+ <DIV
+ CLASS="rich-panel
#{compositeComponent.attrs.styleClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify: read-only;">
+ <DIV
+ CLASS="rich-panel-header
#{compositeComponent.attrs.headerClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <SPAN STYLE="-moz-user-modify: read-only;">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify: read-only;">
+ Navigation
+</SPAN>
+ </SPAN>
+ </DIV>
+ </SPAN>
+ <DIV
+ CLASS="rich-panel-body
#{compositeComponent.attrs.bodyClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <TABLE BORDER="0"
+ STYLE="-moz-user-modify: read-only;">
+ <TBODY>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:ajax</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:jsFunction</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:mediaOutput</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:push</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:status</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:outputPanel</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:commandButton</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:commandLink</SPAN>
+ </A>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <A STYLE="-moz-user-modify: read-only;"
+ CLASS="">
+ <SPAN CLASS="vpe-text"
+ STYLE="-moz-user-modify:
read-only;">a4j:log</SPAN>
+ </A>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </SPAN>
+ </TD>
+ <TD
+ CLASS="content_col rich-page-body #{cc.attrs.bodyClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <SPAN CLASS="vpe-text">
+ Welcome To RichFaces 4.x Demo
+</SPAN>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </TD>
+ </TR>
+ <TR STYLE="-moz-user-modify: read-only;">
+ <TD CLASS="footer_bg" STYLE="-moz-user-modify:
read-only;">
+ <DIV
+ CLASS="footer_bg_content rich-page-footer
#{cc.attrs.footerClass}"
+ STYLE="-moz-user-modify: read-only;">
+ <SPAN STYLE="display: none; -moz-user-modify:
read-only;">
+ </SPAN>
+ </DIV>
+ </TD>
+ </TR>
+ </TBODY>
+ </TABLE>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/templates/main-web-content2.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/templates/main-web-content2.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent2/templates/main-web-content2.xhtml 2011-09-28
10:41:10 UTC (rev 35109)
@@ -0,0 +1,26 @@
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:rich="http://java.sun.com/jsf/composite/rich">
+<h:head>
+</h:head>
+<h:body>
+ <ui:composition>
+ <rich:page id="page">
+ <f:facet name="header">
+ <h1>Welcome to RichFaces demo!</h1>
+ </f:facet>
+ <f:facet name="sidebar">
+ <ui:include src="/templates/includes/navigation.xhtml" />
+ </f:facet>
+ <ui:insert name="body">
+ Body content missed
+ </ui:insert>
+ <f:facet name="footer">
+ footer
+ </f:facet>
+ </rich:page>
+ </ui:composition>
+</h:body>
+</html>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllImportantTests.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllImportantTests.java 2011-09-28
10:32:56 UTC (rev 35108)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllImportantTests.java 2011-09-28
10:41:10 UTC (rev 35109)
@@ -68,6 +68,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JsfJbide2362Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.MessageResolutionInPreviewTabTest;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.MozDirtyTest_JBIDE5105;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.MultipleWebRootFoldersTest_JBIDE9753;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.NullPointerWithStyleProperty_JBIDE5193;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnCssClassTest_JBIDE4775;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.OpenOnInJarPackageFragment_JBIDE5682;
@@ -105,6 +106,7 @@
suite.addTestSuite(UnclosedELExpressionTest.class);
suite.addTestSuite(TestContextPathResolution.class);
suite.addTestSuite(JBIDE5920Test.class);
+ suite.addTestSuite(MultipleWebRootFoldersTest_JBIDE9753.class);
suite.addTestSuite(RenderFacetAndInsertChildrenTest.class);
suite.addTestSuite(EditFontFamilyTest_JBIDE5872.class);
suite.addTestSuite(ChangeMessageBundleTest_JBIDE5818.class);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2011-09-28
10:32:56 UTC (rev 35108)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/FileUtil.java 2011-09-28
10:41:10 UTC (rev 35109)
@@ -60,6 +60,7 @@
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.resref.core.ResourceReference;
+import org.jboss.tools.jst.web.WebUtils;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeIncludeInfo;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
@@ -270,9 +271,15 @@
} else {
//WebArtifactEdit edit = WebArtifactEdit
// .getWebArtifactEditForRead(includeFile.getProject());
- IFolder defaultWebRootFolder = getDefaultWebRootFolder(includeFile);
- if (defaultWebRootFolder != null) {
- file = defaultWebRootFolder.getFile(fileName);
+ IContainer[] webRootFolders = WebUtils.getWebRootFolders(includeFile.getProject());
+ if (webRootFolders != null) {
+ for (IContainer webRootFolder : webRootFolders) {
+ IFile handle = webRootFolder.getFile(new Path(fileName));
+ if (handle.exists()) {
+ file = handle;
+ break;
+ }
+ }
} else {
/* Yahor Radtsevich (yradtsevich):
* Fix of JBIDE-4416: assume that the parent directory
@@ -302,14 +309,11 @@
return null;
}
- IVirtualComponent component = ComponentCore.createComponent(project);
- if (component == null) {
- return null;
+ IContainer[] webRootFolders = WebUtils.getWebRootFolders(project);
+ IPath defaultWebRootPath = null;
+ if (webRootFolders != null && webRootFolders.length > 0) {
+ defaultWebRootPath = webRootFolders[0].getFullPath();
}
-
- IVirtualFolder webRootFolder = component.getRootFolder()
- .getFolder(new Path("/")); //$NON-NLS-1$
- IPath defaultWebRootPath = webRootFolder.getUnderlyingFolder().getFullPath();
if (defaultWebRootPath == null) {
return null;
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-09-28
10:32:56 UTC (rev 35108)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2011-09-28
10:41:10 UTC (rev 35109)
@@ -772,12 +772,12 @@
return Integer.toString(position) + PX_STRING;
}
- public static String processUrl(String url, IFile file) {
+ public static String processUrl(String url, IFile baseFile) {
String resolvedUrl = url.replaceFirst(
"^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
Constants.EMPTY); //$NON-NLS-1$
- resolvedUrl = ElServiceUtil.replaceEl(file, resolvedUrl);
+ resolvedUrl = ElServiceUtil.replaceEl(baseFile, resolvedUrl);
URI uri = null;
try {
@@ -796,14 +796,14 @@
Path path = new Path(decodedUrl);
if (decodedUrl.startsWith("/") //$NON-NLS-1$
- && path.segment(0).equals(file.getProject().getName())) {
+ && path.segment(0).equals(baseFile.getProject().getName())) {
decodedUrl = "/" //$NON-NLS-1$
+ path.removeFirstSegments(1).toPortableString();
}
- IPath location = FileUtil.getFile(decodedUrl, file).getLocation();
- if (location != null) {
- return pathToUrl(location);
+ IFile file = FileUtil.getFile(decodedUrl, baseFile);
+ if (file != null && file.getLocation() != null) {
+ return pathToUrl(file.getLocation());
}
return resolvedUrl;
}