Author: estherbin
Date: 2008-07-18 09:24:41 -0400 (Fri, 18 Jul 2008)
New Revision: 9174
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
Log:
Complete.
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-18
12:42:35 UTC (rev 9173)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-07-18
13:24:41 UTC (rev 9174)
@@ -2288,7 +2288,11 @@
protected nsIDOMNode createTextNode(Node sourceNode, boolean registerFlag) {
String sourceText = sourceNode.getNodeValue();
-
+ if(sourceText!=null){
+ final IFile file =
getPageContext().getVisualBuilder().getCurrentIncludeInfo().getFile();
+
+ sourceText = ElService.getInstance().replaceEl(file, sourceText);
+ }
/*
* Max Areshkau this code causes very slow work of visual editor
* when we editing in big files txt nodes.For example exmployee.xhtml
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-18
12:42:35 UTC (rev 9173)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeAbstractTemplate.java 2008-07-18
13:24:41 UTC (rev 9174)
@@ -40,7 +40,6 @@
import org.jboss.tools.vpe.editor.util.SelectionUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
@@ -1483,23 +1482,29 @@
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)) {
+ if ((file != null) && 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()));
+ if(text instanceof Text){
+ ((Text)text).setData(ElService.getInstance().replaceEl(file,
((TextImpl)text).getData()));
+ }else if((sourceNode.getFirstChild()!=null) &&
(sourceNode.getFirstChild().getFirstChild() instanceof Text)){
+ text = sourceNode.getFirstChild().getFirstChild();
+ ((Text)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()));
-
- }
- if ((sourceNode.getChildNodes() != null) &&
(sourceNode.getChildNodes().getLength() > 0)) {
- for (int j = 0; j < sourceNode.getChildNodes().getLength(); j++) {
- beforeTemplateCreated(pageContext,
sourceNode.getChildNodes().item(j), domDocument);
+ final NamedNodeMap nodeMap = sourceNode.getAttributes();
+
+ if ((nodeMap != null) && (nodeMap.getLength() > 0)) {
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ final Attr n = (Attr) nodeMap.item(i);
+
+ 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);
+ }
+ }
}
}