Author: yradtsevich
Date: 2010-10-07 09:30:26 -0400 (Thu, 07 Oct 2010)
New Revision: 25555
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
https://jira.jboss.org/browse/JBIDE-7258 :
DnD in VPE does not work with rich:calendar
- VpeVisualDomBuilder and VpeDnD have been refactored
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-10-07
13:10:30 UTC (rev 25554)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-10-07
13:30:26 UTC (rev 25555)
@@ -23,7 +23,6 @@
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.eclipse.wst.xml.core.internal.document.NodeContainer;
-import org.eclipse.wst.xml.xpath.core.util.XSLTXPathHelper;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.XFileObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
@@ -70,6 +69,7 @@
import org.mozilla.interfaces.nsITransferable;
import org.mozilla.xpcom.Mozilla;
import org.w3c.dom.Document;
+import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
@@ -549,8 +549,8 @@
if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
System.out.print(" dragNode: " + element.getNodeName() + "(" +
element + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
-
- canDrag = vpeController.getVisualBuilder().canInnerDrag(element);
+
+ canDrag = canInnerDrag(element);
if (canDrag) {
Node sourceNode = getSourceNode(element);
if (sourceNode == null) {
@@ -564,6 +564,22 @@
return canDrag;
}
+ private boolean canInnerDrag(nsIDOMElement visualDragElement) {
+ VpeNodeMapping domMapping = vpeController.getDomMapping()
+ .getNodeMapping(visualDragElement);
+ if (domMapping instanceof VpeElementMapping) {
+ VpeElementMapping elementMapping = (VpeElementMapping) domMapping;
+ if (elementMapping.getSourceNode() instanceof Element) {
+ return elementMapping.getTemplate().canInnerDrag(
+ vpeController.getPageContext(),
+ (Element) elementMapping.getSourceNode(),
+ vpeController.getXulRunnerEditor().getDOMDocument(),
+ visualDragElement, elementMapping.getData());
+ }
+ }
+ return false;
+ }
+
private Node getSourceNode(nsIDOMNode visualNode) {
return vpeController.getDomMapping().getNearSourceNode(visualNode);
}
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-10-07
13:10:30 UTC (rev 25554)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2010-10-07
13:30:26 UTC (rev 25555)
@@ -1301,21 +1301,6 @@
return false;
}
- public boolean canInnerDrag(nsIDOMElement visualDragElement) {
- VpeNodeMapping node = domMapping.getNodeMapping(visualDragElement);
- if (node instanceof VpeElementMapping) {
- VpeElementMapping elementMapping = (VpeElementMapping) node;
- if (elementMapping != null
- && elementMapping.getSourceNode() instanceof Element) {
- return elementMapping.getTemplate().canInnerDrag(pageContext,
- (Element) elementMapping.getSourceNode(),
- getVisualDocument(), visualDragElement,
- elementMapping.getData());
- }
- }
- return false;
- }
-
public void innerDrop(Node dragNode, Node container, int offset) {
VpeNodeMapping mapping = domMapping.getNearNodeMapping(container);
if (mapping != null) {