Author: vyemialyanchyk
Date: 2007-11-01 10:47:10 -0400 (Thu, 01 Nov 2007)
New Revision: 4631
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1200
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 2007-11-01
14:38:37 UTC (rev 4630)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-11-01
14:47:10 UTC (rev 4631)
@@ -241,6 +241,26 @@
return false;
}
+ private boolean reCreateNode(nsIDOMNode visualOldNode, Node sourceNode, nsIDOMNode
visualContainer) {
+ nsIDOMNode visualNewNode = createNode(sourceNode, visualContainer);
+ try {
+ if (visualNewNode != null) {
+ nsIDOMHTMLInputElement iDOMInputElement = (nsIDOMHTMLInputElement)
visualNewNode.queryInterface(nsIDOMHTMLInputElement.NS_IDOMHTMLINPUTELEMENT_IID);
+ iDOMInputElement.setReadOnly(true);
+ }
+ } catch(XPCOMException ex) {
+ //just ignore this exception
+ }
+ if (visualNewNode != null) {
+ visualContainer.replaceChild(visualOldNode, visualNewNode);
+ return true;
+ }
+ else {
+ visualContainer.removeChild(visualOldNode);
+ }
+ return false;
+ }
+
private nsIDOMElement createBorder(Node sourceNode,
nsIDOMElement visualNode, boolean block) {
nsIDOMElement border = null;
@@ -799,8 +819,7 @@
nsIDOMNode visualContainer = visualOldNode.getParentNode();
nsIDOMNode visualNextNode = visualOldNode.getNextSibling();
if (visualContainer != null) {
- visualContainer.removeChild(visualOldNode);
- addNode(sourceNode, visualNextNode, visualContainer);
+ reCreateNode(visualOldNode, sourceNode, visualContainer);
}
} else {
if (sourceNode.getNodeType() == Node.TEXT_NODE) {
@@ -2003,7 +2022,9 @@
protected nsIDOMNode createTextNode(Node sourceNode, boolean registerFlag ) {
String sourceText = sourceNode.getNodeValue();
if (sourceText.trim().length() <= 0) {
- registerNodes(new VpeNodeMapping(sourceNode, null));
+ if (registerFlag) {
+ registerNodes(new VpeNodeMapping(sourceNode, null));
+ }
return null;
}