Author: mareshkau
Date: 2008-08-05 08:15:36 -0400 (Tue, 05 Aug 2008)
New Revision: 9513
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.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/util/Constants.java
Log:
JBIDE-2584
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-08-05
11:10:43 UTC (rev 9512)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-08-05
12:15:36 UTC (rev 9513)
@@ -105,9 +105,6 @@
private static final String PSEUDO_ELEMENT_ATTR = "vpe:pseudo-element";
//$NON-NLS-1$
private static final String INIT_ELEMENT_ATTR = "vpe:init-element";
//$NON-NLS-1$
private static final String MOZ_ANONCLASS_ATTR = "_MOZ_ANONCLASS";
//$NON-NLS-1$
- private static final String COMMENT_STYLE = "font-style:italic;
color:green"; //$NON-NLS-1$
- private static final String COMMENT_PREFIX = ""; //$NON-NLS-1$
- private static final String COMMENT_SUFFIX = ""; //$NON-NLS-1$
private static final String INCLUDE_ELEMENT_ATTR = "vpe:include-element";
//$NON-NLS-1$
private static final int DRAG_AREA_WIDTH = 10;
private static final int DRAG_AREA_HEIGHT = 10;
@@ -419,14 +416,6 @@
return null;
}
-//
-// if(sourceNode.getNodeType() == Node.TEXT_NODE){
-// System.err.println("Hello world");
-// }
-// switch (sourceNode.getNodeType()) {
-
-// case Node.ELEMENT_NODE:
-// Map<?, ?> xmlnsMap = createXmlns((Element) sourceNode);
Set<Node> ifDependencySet = new HashSet<Node>();
pageContext.setCurrentVisualNode(visualOldContainer);
VpeTemplate template = templateManager.getTemplate(pageContext,
@@ -537,19 +526,6 @@
return border;
else
return visualNewNode;
-// case Node.TEXT_NODE:
-// return createTextNode(sourceNode, registerFlag);
-// case Node.COMMENT_NODE:
-// if (!YES_STRING.equals(VpePreference.SHOW_COMMENTS.getValue())) {
-// return null;
-// }
-// nsIDOMElement visualNewComment = createComment(sourceNode);
-// if (registerFlag) {
-// registerNodes(new VpeNodeMapping(sourceNode, visualNewComment));
-// }
-// return visualNewComment;
-// }
-// return null;
}
private void correctVisualAttribute(nsIDOMElement element) {
@@ -572,16 +548,6 @@
}
}
- private nsIDOMElement createComment(Node sourceNode) {
- nsIDOMElement div = visualDocument.createElement(HTML.TAG_DIV);
- div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, COMMENT_STYLE);
- String value = COMMENT_PREFIX + sourceNode.getNodeValue()
- + COMMENT_SUFFIX;
- nsIDOMText text = visualDocument.createTextNode(value);
- div.appendChild(text);
- return div;
- }
-
protected void addChildren(VpeTemplate containerTemplate,
Node sourceContainer, nsIDOMNode visualContainer) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java 2008-08-05
11:10:43 UTC (rev 9512)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Constants.java 2008-08-05
12:15:36 UTC (rev 9513)
@@ -16,5 +16,5 @@
public static final String TRUE = "true"; //$NON-NLS-1$
public static final String FALSE = "false"; //$NON-NLS-1$
public static final String EMPTY = ""; //$NON-NLS-1$
-
+ public static final String YES_STRING = "yes"; //$NON-NLS-1$
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java 2008-08-05
11:10:43 UTC (rev 9512)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlCommentTemplate.java 2008-08-05
12:15:36 UTC (rev 9513)
@@ -10,11 +10,17 @@
******************************************************************************/
package org.jboss.tools.vpe.html.template;
+import org.jboss.tools.jst.jsp.preferences.VpePreference;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Node;
/**
@@ -23,15 +29,24 @@
*/
public class HtmlCommentTemplate extends VpeAbstractTemplate {
+ private static final String COMMENT_STYLE = "font-style:italic;
color:green"; //$NON-NLS-1$
/* (non-Javadoc)
* @see
org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
*/
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
-
- nsIDOMNode commentNode = visualDocument.createComment(sourceNode.getNodeValue());
-
- return new VpeCreationData(commentNode);
+ nsIDOMNode visualNode;
+ if (Constants.YES_STRING.equals(VpePreference.SHOW_COMMENTS_VALUE)) {
+ visualNode = visualDocument.createElement(HTML.TAG_DIV);
+ ((nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID)).setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE,
COMMENT_STYLE);
+ String value = sourceNode.getNodeValue();
+ nsIDOMText text = visualDocument.createTextNode(value);
+
((nsIDOMElement)visualNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID)).appendChild(text);
+
+ } else {
+ visualNode = visualDocument.createComment(sourceNode.getNodeValue());
+ }
+ return new VpeCreationData(visualNode);
}
}
Show replies by date