Author: dvinnichek
Date: 2010-12-07 07:57:36 -0500 (Tue, 07 Dec 2010)
New Revision: 27211
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
fixed updating of <![CDATA[...]]> section inside <programlisting> in Docbook
editor during editing (
https://jira.jboss.org/browse/JBIDE-7785)
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -657,7 +657,9 @@
int type = ((Node) notifier).getNodeType();
visualEditor.hideResizer();
visualBuilder.setSelectionRectangle(null);
- if (type == Node.TEXT_NODE) {
+ if (type == Node.CDATA_SECTION_NODE) {
+ visualBuilder.setCdataText((Node) notifier);
+ } else if (type == Node.TEXT_NODE) {
boolean update = visualBuilder.setText((Node) notifier);
visualEditor.showResizer();
// Added by Max Areshkau JBIDE-1554
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 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -55,6 +55,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.template.expression.VpeExpressionException;
+import org.jboss.tools.vpe.editor.util.Docbook;
import org.jboss.tools.vpe.editor.util.ElService;
import org.jboss.tools.vpe.editor.util.FaceletUtil;
import org.jboss.tools.vpe.editor.util.HTML;
@@ -340,8 +341,9 @@
// we shouldn't process this node
if (sourceNode == null
|| (sourceNode.getNodeType() != Node.TEXT_NODE
- && sourceNode.getNodeType() != Node.ELEMENT_NODE && sourceNode
- .getNodeType() != Node.COMMENT_NODE)) {
+ && sourceNode.getNodeType() != Node.ELEMENT_NODE
+ && sourceNode.getNodeType() != Node.COMMENT_NODE
+ && sourceNode.getNodeType() != Node.CDATA_SECTION_NODE)) {
return null;
}
@@ -872,6 +874,16 @@
}
return null;
}
+
+ public void setCdataText(Node sourceNode) {
+ Node sourceParent = sourceNode.getParentNode();
+ if (sourceParent != null && sourceParent.getLocalName() != null) {
+ String sourceParentName = sourceParent.getLocalName();
+ if (Docbook.ELEMENT_PROGRAMLISTING.equalsIgnoreCase(sourceParentName)) {
+ updateNode(sourceParent);
+ }
+ }
+ }
public boolean setText(Node sourceText) {
Node sourceParent = sourceText.getParentNode();
Copied:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java
(from rev 27181,
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/util/Docbook.java)
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java
(rev 0)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/Docbook.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 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.vpe.editor.util;
+
+/**
+ * @author Denis Vinnichek (dvinnichek)
+ *
+ */
+public class Docbook {
+
+ public static final String ATTR_XREFLABEL = "xreflabel"; //$NON-NLS-1$
+ public static final String ATTR_LINKEND = "linkend"; //$NON-NLS-1$
+ public static final String ATTR_ENDTERM = "endterm"; //$NON-NLS-1$
+
+ public static final String ELEMENT_TITLE = "title"; //$NON-NLS-1$
+ public static final String ELEMENT_TIP = "tip"; //$NON-NLS-1$
+ public static final String ELEMENT_NOTE = "note"; //$NON-NLS-1$
+ public static final String ELEMENT_WARNING = "warning"; //$NON-NLS-1$
+ public static final String ELEMENT_CAUTION = "caution"; //$NON-NLS-1$
+ public static final String ELEMENT_IMPORTANT = "important"; //$NON-NLS-1$
+ public static final String ELEMENT_PROGRAMLISTING = "programlisting";
//$NON-NLS-1$
+}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookCautionTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <caution>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookImportantTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <important>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookNoteTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <note>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookProgramlistingTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -13,11 +13,12 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.TextUtil;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -40,14 +41,12 @@
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (childNode.getNodeType() == Node.CDATA_SECTION_NODE) {
- String cdataText = childNode.getNodeValue();
- newElement.appendChild(visualDocument.createTextNode(cdataText));
+ String cdataText = TextUtil.visualText(childNode.getNodeValue());
+ nsIDOMText textElement = visualDocument.createTextNode(cdataText);
+ newElement.appendChild(textElement);
} else {
nsIDOMElement spanElement = visualDocument.createElement(HTML.TAG_SPAN);
newElement.appendChild(spanElement);
- VpeChildrenInfo info = new VpeChildrenInfo(spanElement);
- info.addSourceChild(childNode);
- creationData.addChildrenInfo(info);
}
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookTipTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <tip>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookWarningTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,7 +11,7 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
+import org.jboss.tools.vpe.editor.util.Docbook;
/**
* Class for <warning>
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/DocbookXrefTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -13,10 +13,10 @@
import java.text.MessageFormat;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
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.Docbook;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java 2010-12-07
12:40:13 UTC (rev 27210)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.docbook/src/org/jboss/tools/vpe/docbook/template/ElementWithGeneratedOutputTemplate.java 2010-12-07
12:57:36 UTC (rev 27211)
@@ -11,10 +11,10 @@
package org.jboss.tools.vpe.docbook.template;
-import org.jboss.tools.vpe.docbook.template.util.Docbook;
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.Docbook;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VisualDomUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;