Author: mareshkau
Date: 2009-07-28 10:30:44 -0400 (Tue, 28 Jul 2009)
New Revision: 16843
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/1.0/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/1.0/img.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/2.0/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/2.0/img.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/img/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/img/img.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_1.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_2.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/2.0/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/2.0/img.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/us/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/us/img/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/us/img/img.gif
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2550Test.java
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2550, processing resources from JBIDE-2550#2.a
has been added
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml 2009-07-28
14:30:44 UTC (rev 16843)
@@ -0,0 +1,46 @@
+<!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">
+<f:view contentType="text/html" />
+
+<h:head>
+ <meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" />
+ <title>First JSF 2.0 application</title>
+</h:head>
+
+
+<h:body>
+ <h:form>
+ <h:outputText value="JSF 2.0, Resources test Page" />
+ <h:panelGrid columns="2" border="2"
id="jbide2550">
+
+ <h:outputLabel value="resource['img:img.gif']" />
+ <h:graphicImage value="#{resource['img:img.gif']}" />
+
+ <h:outputLabel value="resource['ch/img/1.0/img.gif']" />
+ <h:graphicImage value="#{resource['ch/img/1.0/img.gif']}" />
+
+ <h:outputLabel value=' resource [ "ch/img/2.0:img.gif" ] '
/>
+ <h:graphicImage value='#{ resource [ "ch/img/2.0:img.gif" ]
}' />
+
+ <h:outputLabel value="resource['ru/img/1.0/img.gif']" />
+ <h:graphicImage value="#{resource['ru/img/1.0/img.gif']}" />
+
+ <h:outputLabel value="resource['ru/img/2.0/img.gif']" />
+ <h:graphicImage value="#{resource['ru/img/2.0/img.gif']}" />
+
+ <h:outputLabel value="resource['ru/img/1.0/img.gif/1']" />
+ <h:graphicImage value="#{resource['ru/img/1.0/img.gif/1']}"
/>
+ <h:outputLabel value="resource['ru/img/1.0/img.gif/2.gif']"
/>
+ <h:graphicImage value="#{resource['ru/img/1.0/img.gif/2.gif']}"
/>
+
+ <h:outputLabel value="resource['ru/img/img.gif']" />
+ <h:graphicImage value="#{resource['ru/img/img.gif']}" />
+
+ <h:outputLabel value="resource['us/img/img.gif']" />
+ <h:graphicImage value="#{resource['us/img/img.gif' ]}" />
+ </h:panelGrid>
+ </h:form>
+</h:body>
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/pages/JBIDE/2550/jbide2550.xhtml.xml 2009-07-28
14:30:44 UTC (rev 16843)
@@ -0,0 +1,107 @@
+<tests>
+ <test id="jbide2550">
+ <TABLE BORDER="2" STYLE="-moz-user-modify: read-write;" >
+<TBODY>
+<TR>
+<TD>
+<LABEL>
+resource['img:img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/jsf2test/WebContent/resources/img/img.gif/"
STYLE="-moz-user-modify: read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ch/img/1.0/img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/jsf2test/WebContent/resources/ch/img/1.0/img.gif/"
STYLE="-moz-user-modify: read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource [ "ch/img/2.0:img.gif" ]
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/jsf2test/WebContent/resources/ch/img/2.0/img.gif/"
STYLE="-moz-user-modify: read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ru/img/1.0/img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/ve/unresolved_image.gif/" STYLE="-moz-user-modify:
read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ru/img/2.0/img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/jsf2test/WebContent/resources/ru/img/2.0/img.gif/"
STYLE="-moz-user-modify: read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ru/img/1.0/img.gif/1']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/ve/unresolved_image.gif/" STYLE="-moz-user-modify:
read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ru/img/1.0/img.gif/2.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/ve/unresolved_image.gif/" STYLE="-moz-user-modify:
read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['ru/img/img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/ve/unresolved_image.gif/" STYLE="-moz-user-modify:
read-write;"/>
+
+</TD>
+</TR>
+<TR>
+<TD>
+<LABEL>
+resource['us/img/img.gif']
+</LABEL>
+</TD>
+<TD>
+<IMG SRC="/.*/jsf2test/WebContent/resources/us/img/img.gif/"
STYLE="-moz-user-modify: read-write;"/>
+
+</TD>
+</TR>
+</TBODY>
+</TABLE>
+ </test>
+</tests>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/1.0/img.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/1.0/img.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/2.0/img.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ch/img/2.0/img.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/img/img.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/img/img.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_1.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_1.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_2.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/1.0/img_2.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/2.0/img.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/ru/img/2.0/img.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/us/img/img.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsf2test/WebContent/resources/us/img/img.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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 2009-07-28
14:21:06 UTC (rev 16842)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-07-28
14:30:44 UTC (rev 16843)
@@ -33,6 +33,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2434Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2505Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2526Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2550Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2582Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2584Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE2594Test;
@@ -155,6 +156,7 @@
suite.addTestSuite(JBIDE4510Test.class);
suite.addTestSuite(JBIDE4534Test.class);
suite.addTestSuite(JBIDE3247Test.class);
+ suite.addTestSuite(JBIDE2550Test.class);
// $JUnit-END$
// added by Max Areshkau
// add here projects which should be imported for junit tests
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2550Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2550Test.java
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE2550Test.java 2009-07-28
14:30:44 UTC (rev 16843)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.vpe.ui.test.ComponentContentTest;
+
+/**
+ * @author mareshkau
+ *
+ */
+public class JBIDE2550Test extends ComponentContentTest {
+
+ public JBIDE2550Test(String name) {
+ super(name);
+ }
+
+ public void testJBIDE2550TestResourceFromWebRoot() throws Throwable{
+ performContentTest("JBIDE/2550/jbide2550.xhtml"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected String getTestProjectName() {
+ return JsfAllTests.IMPORT_JSF_20_PROJECT_NAME;
+ }
+
+}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2009-07-28
14:21:06 UTC (rev 16842)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2009-07-28
14:30:44 UTC (rev 16843)
@@ -13,6 +13,8 @@
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
@@ -44,7 +46,10 @@
public class VpeFunctionSrc extends VpeFunction {
static final String IMG_UNRESOLVED = "unresolved_image.gif"; //$NON-NLS-1$
static final String IMG_PREFIX = "file:///"; //$NON-NLS-1$
-
+ private static final Pattern resourcePatternWithSinglCoat=
Pattern.compile("[#\\$]\\{\\s*resource\\s*\\[\\s*'(.*)'\\s*\\]\\s*\\}");
//$NON-NLS-1$
+ private static final Pattern resourcePatternWithDoableCoat=
Pattern.compile("[#\\$]\\{\\s*resource\\s*\\[\\s*\"(.*)\"\\s*\\]\\s*\\}");
//$NON-NLS-1$
+
+
public VpeValue exec(VpePageContext pageContext, Node sourceNode) throws
VpeExpressionException {
String tagValue = getParameter(0).exec(pageContext, sourceNode)
.stringValue();
@@ -249,6 +254,16 @@
*/
protected String resolveEL(VpePageContext pageContext, String value) {
String resolvedValue =
value.replaceFirst("^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
""); //$NON-NLS-1$ //$NON-NLS-2$
+
+ //fix for JBIDE-2550, author Maksim Areshkau
+ Matcher singleCoatMatcher =
resourcePatternWithSinglCoat.matcher(resolvedValue);
+ Matcher doubleCoatMatcher =
resourcePatternWithDoableCoat.matcher(resolvedValue);
+ if(doubleCoatMatcher.find()) {
+ resolvedValue = processJSF2Resource(doubleCoatMatcher);
+ }else if(singleCoatMatcher.find()){
+ resolvedValue = processJSF2Resource(singleCoatMatcher);
+ }
+
//Fix for JBIDE-3030
if(pageContext.getVisualBuilder().getCurrentIncludeInfo()==null
|| !(pageContext.getVisualBuilder().getCurrentIncludeInfo() instanceof
IFile)){
@@ -259,6 +274,17 @@
resolvedValue = ElService.getInstance().replaceEl(file, resolvedValue);
return resolvedValue;
}
+ /**
+ * See JBIDE-2550
+ * @param matcher
+ * @return
+ */
+ private static final String processJSF2Resource(Matcher matcher){
+ String resulString = matcher.group(1);
+ resulString=resulString.replaceAll(":", "/");
//$NON-NLS-1$//$NON-NLS-2$
+ resulString = "/resources/"+resulString; //$NON-NLS-1$
+ return resulString;
+ }
public static String getAbsoluteResourcePath(String resourcePathInPlugin) {
String pluginPath = VpePlugin.getPluginResourcePath();