Author: estherbin
Date: 2008-07-17 11:04:47 -0400 (Thu, 17 Jul 2008)
New Revision: 9165
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/template/VpeAbstractTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
ADD JUNIT
https://jira.jboss.com:8443/jira/browse/JBIDE-2010
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 2008-07-17
15:04:41 UTC (rev 9164)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-07-17
15:04:47 UTC (rev 9165)
@@ -436,11 +436,14 @@
//
// }
- if (template.getClass().getName().contains("Rich") ||
template.getClass().getName().contains("Jsf")) {
+ if (template.getClass().getName().contains("Rich") ||
template.getClass().getName().contains("Jsf")
+ ||
template.getClass().getName().toLowerCase().contains("vpehtmltemplate")
+ /*||
template.getClass().getName().toLowerCase().contains("vpecomposition")*/) {
final Element sourceNodeClone = (Element) ((Element)
sourceNode).cloneNode(true);
+
template.beforeTemplateCreated(getPageContext(), sourceNodeClone,
getVisualDocument());
creationData = template.create(getPageContext(), sourceNodeClone,
getVisualDocument());
- }else{
+ } else {
creationData = template.create(getPageContext(), sourceNode,
getVisualDocument());
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-07-17
15:04:41 UTC (rev 9164)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-07-17
15:04:47 UTC (rev 9165)
@@ -21,6 +21,7 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
+import org.eclipse.wst.xml.core.internal.document.TextImpl;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
import org.jboss.tools.vpe.VpePlugin;
import org.jboss.tools.vpe.editor.VpeSourceInnerDragInfo;
@@ -1473,22 +1474,34 @@
// }
// }
// }
-// }
+// }
//
// System.err.println("Hello world4");
}
+ @SuppressWarnings("restriction")
public void beforeTemplateCreated(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument domDocument) {
final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
if ((file != null) && (sourceNode.getNodeType() == Node.ELEMENT_NODE)
&& ElService.getInstance().isAvailable(file)) {
+ // Node first((Element
+ Node text = sourceNode.getFirstChild();
+ if(text instanceof TextImpl){
+ ((TextImpl)text).setData(ElService.getInstance().replaceEl(file,
((TextImpl)text).getData()));
+ }
final NamedNodeMap nodeMap = sourceNode.getAttributes();
for (int i = 0; i < nodeMap.getLength(); i++) {
final Attr n = (Attr)nodeMap.item(i);
- n.setValue(ElService.getInstance().replaceEl(file, n.getValue()));
+ n.setValue(ElService.getInstance().replaceEl(file, n.getValue()));
}
+ if ((sourceNode.getChildNodes() != null) &&
(sourceNode.getChildNodes().getLength() > 0)) {
+ for (int j = 0; j < sourceNode.getChildNodes().getLength(); j++) {
+ beforeTemplateCreated(pageContext,
sourceNode.getChildNodes().item(j), domDocument);
+ }
+ }
+
}
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java 2008-07-17
15:04:41 UTC (rev 9164)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionHref.java 2008-07-17
15:04:47 UTC (rev 9165)
@@ -32,7 +32,7 @@
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
String tagValue = getParameter(0).exec(pageContext, sourceNode).stringValue();
- tagValue = resolveEL(tagValue);
+ tagValue = resolveEL(pageContext,tagValue);
IPath tagPath = new Path(tagValue);
if (tagPath.isEmpty()) {
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 2008-07-17
15:04:41 UTC (rev 9164)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2008-07-17
15:04:47 UTC (rev 9165)
@@ -35,6 +35,7 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.css.ResourceReference;
import org.jboss.tools.vpe.editor.template.VpeCreatorUtil;
+import org.jboss.tools.vpe.editor.util.ElService;
import org.w3c.dom.Node;
public class VpeFunctionSrc extends VpeFunction {
@@ -44,10 +45,9 @@
public VpeValue exec(VpePageContext pageContext, Node sourceNode) {
String tagValue = getParameter(0).exec(pageContext, sourceNode)
.stringValue();
-
- tagValue = resolveEL(tagValue);
-
+ tagValue = resolveEL(pageContext,tagValue);
IFile iFile = VpeCreatorUtil.getFile(tagValue, pageContext);
+
if (iFile != null) {
return new VpeValue(getPrefix()+iFile.getLocation().toString());
}
@@ -235,9 +235,11 @@
* temporary solution to solve #{facesContext.externalContext.requestContextPath}
* JBIDE-1410
*/
- protected String resolveEL(String value) {
- String resolvedValue =
value.replaceFirst("^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
""); //$NON-NLS-1$ //$NON-NLS-2$
-
- return resolvedValue;
+ protected String resolveEL(VpePageContext pageContext, String value) {
+ String resolvedValue =
value.replaceFirst("^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
""); //$NON-NLS-1$ //$NON-NLS-2$
+ final IFile file =
pageContext.getVisualBuilder().getCurrentIncludeInfo().getFile();
+
+ resolvedValue = ElService.getInstance().replaceEl(file, resolvedValue);
+ return resolvedValue;
}
}
\ No newline at end of file