Author: sdzmitrovich
Date: 2008-04-03 06:29:19 -0400 (Thu, 03 Apr 2008)
New Revision: 7278
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1373
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfVerbatim.java 2008-04-03
10:29:19 UTC (rev 7278)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template;
+
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.template.EditableTemplateAdapter;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.TemplateManagingUtil;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class JsfVerbatim extends EditableTemplateAdapter {
+
+ /**
+ * Instantiates a new jsf view.
+ */
+ public JsfVerbatim() {
+ }
+
+ /*
+ * (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) {
+
+ Element element = (Element) sourceNode;
+
+ nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
+
+ NodeList list = element.getChildNodes();
+
+ if (list.getLength() != 0) {
+ Node firstNode = list.item(0);
+ Node lastNode = list.item(list.getLength() - 1);
+
+ String text = TemplateManagingUtil.getSourceText(pageContext,
+ ((IDOMNode) firstNode).getStartOffset(),
+ ((IDOMNode) lastNode).getEndOffset() - 1);
+
+ span.appendChild(visualDocument.createTextNode(text));
+
+ }
+
+ VpeCreationData creationData = new VpeCreationData(span);
+
+ return creationData;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#isRecreateAtAttrChange(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Element, org.mozilla.interfaces.nsIDOMDocument,
+ * org.mozilla.interfaces.nsIDOMElement, java.lang.Object,
+ * java.lang.String, java.lang.String)
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
+}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03
10:15:29 UTC (rev 7277)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/templates/vpe-templates-jsf.xml 2008-04-03
10:29:19 UTC (rev 7278)
@@ -11,6 +11,15 @@
</vpe:tag>
<vpe:tag name="f:verbatim" case-sensitive="yes">
+ <vpe:if test="(@escape='false')">
+ <vpe:template children="no" modify="yes"
+ class="org.jboss.tools.jsf.vpe.jsf.template.JsfVerbatim">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
<vpe:template children="yes" modify="yes">
<span title="{tagstring()}" />
<vpe:dnd>