Author: mareshkau
Date: 2009-01-06 13:40:45 -0500 (Tue, 06 Jan 2009)
New Revision: 12904
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/body.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/footer.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml.xml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/template.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/title.xhtml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml.xml
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/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3482
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml 2009-01-06
18:12:02 UTC (rev 12903)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -1,4 +1,4 @@
-<!1DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
@@ -15,9 +15,7 @@
<rich:scrollableDataTable style="#{test.scrolable}" width="100px;"
height="100px;" >
<rich:columns style="#{test.columnsColor}"> </rich:columns>
</rich:scrollableDataTable>
-<rich:dataGrid style="#{test.richDataGrid}">
-ssssssssss
-</rich:dataGrid>
+<h:outputText style="#{test.richDataGrid}" value="ssssssssss
"/>
</div>
</ui:define>
-<ui:composition>
+</ui:composition>
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml.xml 2009-01-06
18:12:02 UTC (rev 12903)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3144/jbide3214test.xhtml.xml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -45,12 +45,9 @@
</TR>
</TABLE>
</DIV>
-<TABLE STYLE="background-color: pink;" CLASS="dr-table
rich-table">
-<COLGROUP SPAN="1">
-</COLGROUP>
-<TBODY>
-</TBODY>
-</TABLE>
+<SPAN STYLE="background-color: pink;">
+ssssssssss
+</SPAN>
</DIV>
</test>
</tests>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/body.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/body.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/body.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1,9 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ This text should be ignored
+ <ui:composition>JBIDE-3482 Body</ui:composition>
+ This Text should be ignored
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/footer.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/footer.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/footer.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1 @@
+<span style="background-color: green;">JBIDE-3482</span><span
style="background-color: blue;">Footer</span>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1,13 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ This text should be ignored
+ <ui:composition template="/pages/JBIDE/3482/template.xhtml">
+ <ui:define name="title"><ui:include
src="/pages/JBIDE/3482/title.xhtml"/></ui:define>
+ <ui:define name="body"><ui:include
src="/pages/JBIDE/3482/body.xhtml" /></ui:define>
+ <ui:define name="footer"><ui:include
src="/pages/JBIDE/3482/footer.xhtml" /></ui:define>
+ </ui:composition>
+ This text should be ignored
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml.xml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml.xml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/jbide3482.xhtml.xml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1,30 @@
+<tests>
+ <test id="jbide3482Test">
+<DIV ID="jbide3482Test" STYLE="-moz-user-modify: read-only;">
+<H1 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;">
+JBIDE-3482 Header
+</SPAN>
+</DIV>
+</H1>
+<DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+<SPAN CLASS="vpe-text" STYLE="-moz-user-modify: read-only;">
+JBIDE-3482 Body
+</SPAN>
+</DIV>
+<DIV VPE:INCLUDE-ELEMENT="yes" STYLE="-moz-user-modify:
read-only;">
+<SPAN STYLE="background-color: green; -moz-user-modify: read-only;">
+<SPAN CLASS="vpe-text" STYLE="-moz-user-modify: read-only;">
+JBIDE-3482
+</SPAN>
+</SPAN>
+<SPAN STYLE="background-color: blue; -moz-user-modify: read-only;">
+<SPAN CLASS="vpe-text" STYLE="-moz-user-modify: read-only;">
+Footer
+</SPAN>
+</SPAN>
+</DIV>
+</DIV>
+</test>
+</tests>
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/template.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/template.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/template.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1,19 @@
+<!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:ui="http://java.sun.com/jsf/facelets">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
/>
+<title><ui:insert name="title">Default
Title</ui:insert></title>
+</head>
+
+<body>
+<div id="jbide3482Test">
+<h1>
+ <ui:insert name="title">Default Title</ui:insert>
+</h1>
+ <ui:insert name="body">Default Body</ui:insert>
+ <ui:insert name="footer">Default Footer</ui:insert>
+ </div>
+</body>
+
+</html>
\ No newline at end of file
Added:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/title.xhtml
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/title.xhtml
(rev 0)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/3482/title.xhtml 2009-01-06
18:40:45 UTC (rev 12904)
@@ -0,0 +1,11 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core">
+ This text should be ignored
+<ui:component>
+ JBIDE-3482 Header
+</ui:component>
+ This Text should be ignored
+</html>
\ No newline at end of file
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-01-06
18:12:02 UTC (rev 12903)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-01-06
18:40:45 UTC (rev 12904)
@@ -47,6 +47,7 @@
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3376Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3396Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3441Test;
+import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE3482Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE675Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE788Test;
import org.jboss.tools.jsf.vpe.jsf.test.jbide.JBIDE924Test;
@@ -119,6 +120,7 @@
suite.addTestSuite(JBIDE3163Test.class);
suite.addTestSuite(JBIDE3376Test.class);
suite.addTestSuite(JBIDE3396Test.class);
+ suite.addTestSuite(JBIDE3482Test.class);
// $JUnit-END$
// added by Max Areshkau
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-01-06
18:12:02 UTC (rev 12903)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2009-01-06
18:40:45 UTC (rev 12904)
@@ -24,7 +24,6 @@
import java.util.Map;
import java.util.Set;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.IDocument;
import org.eclipse.swt.graphics.Point;
@@ -37,13 +36,8 @@
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.eclipse.wst.xml.core.internal.document.NodeImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.jboss.tools.common.model.XModel;
-import org.jboss.tools.common.model.XModelObject;
-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.jsp.preferences.VpePreference;
-import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
import org.jboss.tools.vpe.VpeDebug;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.dnd.VpeDnD;
@@ -58,7 +52,6 @@
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.template.VpeCreatorUtil;
import org.jboss.tools.vpe.editor.template.VpeDefaultPseudoContentCreator;
-import org.jboss.tools.vpe.editor.template.VpeHtmlTemplate;
import org.jboss.tools.vpe.editor.template.VpeTagDescription;
import org.jboss.tools.vpe.editor.template.VpeTemplate;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
@@ -71,6 +64,7 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+import org.jboss.tools.vpe.editor.util.VpeDebugUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.jboss.tools.vpe.resref.core.CSSReferenceList;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
@@ -124,8 +118,6 @@
// TODO Max Areshkau JBIDE-1457
// boolean rebuildFlag = false;
- /** faceletFile */
- private boolean faceletFile = false;
private static final String ATTR_VPE = "vpe"; //$NON-NLS-1$
private static final String ATTR_VPE_INLINE_LINK_VALUE = "inlinelink";
//$NON-NLS-1$
@@ -184,11 +176,11 @@
dropper = new VpeDnd();
dropper.setDndData(false, true);
- if (isFacelet()) {
- faceletFile = true;
- } else {
- faceletFile = false;
- }
+// if (isFacelet()) {
+// faceletFile = true;
+// } else {
+// faceletFile = false;
+// }
this.showInvisibleTags = Constants.YES_STRING
.equals(VpePreference.SHOW_INVISIBLE_TAGS.getValue());
@@ -213,11 +205,10 @@
pageContext.refreshConnector();
pageContext.installIncludeElements();
- if (isFacelet()) {
- Element root = FaceletUtil.getRootFaceletElement(sourceDocument);
- if (root != null) {
+// if (isFacelet()) {
+ Element root = FaceletUtil.findComponentElement(sourceDocument.getDocumentElement());
+ if (root != null) {
addNode(root, null, getContentArea());
- }
} else {
addChildren(null, sourceDocument, getContentArea());
}
@@ -2264,40 +2255,40 @@
return visualEditor.getDomDocument();
}
- /**
- * Check this file is facelet
- *
- * @return this if file is facelet, otherwize false
- */
- private boolean isFacelet() {
- boolean isFacelet = false;
+// /**
+// * Check this file is facelet
+// *
+// * @return this if file is facelet, otherwize false
+// */
+// private boolean isFacelet() {
+// boolean isFacelet = false;
+//
+// IEditorInput iEditorInput = pageContext.getEditPart().getEditorInput();
+// if (iEditorInput instanceof IFileEditorInput) {
+// IFileEditorInput iFileEditorInput = (IFileEditorInput) iEditorInput;
+//
+// IFile iFile = iFileEditorInput.getFile();
+//
+// IProject project = iFile.getProject();
+// IModelNature nature = EclipseResourceUtil.getModelNature(project);
+// if (nature != null) {
+// XModel model = nature.getModel();
+// XModelObject webXML = WebAppHelper.getWebApp(model);
+// XModelObject param = WebAppHelper.findWebAppContextParam(
+// webXML, "javax.faces.DEFAULT_SUFFIX"); //$NON-NLS-1$
+// if (param != null) {
+// String value = param.getAttributeValue("param-value"); //$NON-NLS-1$
+//
+// if (value.length() != 0 && iFile.getName().endsWith(value)) {
+// isFacelet = true;
+// }
+// }
+// }
+// }
+//
+// return isFacelet;
+// }
- IEditorInput iEditorInput = pageContext.getEditPart().getEditorInput();
- if (iEditorInput instanceof IFileEditorInput) {
- IFileEditorInput iFileEditorInput = (IFileEditorInput) iEditorInput;
-
- IFile iFile = iFileEditorInput.getFile();
-
- IProject project = iFile.getProject();
- IModelNature nature = EclipseResourceUtil.getModelNature(project);
- if (nature != null) {
- XModel model = nature.getModel();
- XModelObject webXML = WebAppHelper.getWebApp(model);
- XModelObject param = WebAppHelper.findWebAppContextParam(
- webXML, "javax.faces.DEFAULT_SUFFIX"); //$NON-NLS-1$
- if (param != null) {
- String value = param.getAttributeValue("param-value"); //$NON-NLS-1$
-
- if (value.length() != 0 && iFile.getName().endsWith(value)) {
- isFacelet = true;
- }
- }
- }
- }
-
- return isFacelet;
- }
-
/**
* @return the xulRunnerEditor
*/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java 2009-01-06
18:12:02 UTC (rev 12903)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeIncludeTemplate.java 2009-01-06
18:40:45 UTC (rev 12904)
@@ -20,6 +20,7 @@
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionBuilderException;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
import org.jboss.tools.vpe.editor.template.expression.VpeValue;
+import org.jboss.tools.vpe.editor.util.FaceletUtil;
import org.jboss.tools.vpe.editor.util.FileUtil;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
@@ -118,7 +119,14 @@
VpeCreationData creationData = new VpeCreationData(visualNewElement);
if (children) {
VpeChildrenInfo childrenInfo = new VpeChildrenInfo(visualNewElement);
- NodeList sourceChildren = sourceDocument.getChildNodes();
+ Element root = FaceletUtil.findComponentElement(sourceDocument.getDocumentElement());
+ NodeList sourceChildren=null;
+ //fix for JBIDE-3482
+ if(root==null) {
+ sourceChildren = sourceDocument.getChildNodes();
+ } else {
+ sourceChildren = root.getChildNodes();
+ }
int len = sourceChildren.getLength();
for (int i = 0; i < len; i++) {
childrenInfo.addSourceChild(sourceChildren.item(i));