Author: yradtsevich
Date: 2010-04-21 05:31:44 -0400 (Wed, 21 Apr 2010)
New Revision: 21575
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5042
Enhance DnD support in VPE
- Code cleanup has been done.
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-04-21
09:10:45 UTC (rev 21574)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/VpeDnD.java 2010-04-21
09:31:44 UTC (rev 21575)
@@ -15,12 +15,12 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.XFileObject;
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.editors.dnd.DropUtils;
import org.jboss.tools.common.model.ui.editors.dnd.context.IDNDTextEditor;
@@ -67,13 +67,12 @@
* @author Max Areshkau
* @author Yahor Radtsevich (yradtsevich)
*/
-// TODO: cleanup the code
+// NOTE: the code has been cleaned after SVN revision 21574, many methods
+// have been removed. To find the old code refer to older revisions.
public class VpeDnD implements MozillaDndListener {
private static final String TAG_TAGLIB = "taglib"; //$NON-NLS-1$
- private static int HUGE_DISTANCE = 999999;
-
- /*
+ /*
* Default transfer data
*/
private static final String VPE_ELEMENT = ""; //$NON-NLS-1$
@@ -189,7 +188,7 @@
.isDataFlavorSupported(VpeController.MODEL_FLAVOR)) {
XModelObject object = PreferenceModelUtilities.getPreferenceModel()
.getModelBuffer().source();
- if (object.getFileType() == XModelObject.FILE
+ if (object.getFileType() == XFileObject.FILE
&& !TLDUtil.isTaglib(object)) {
final IFile f = (IFile) EclipseResourceUtil.getResource(object);
return getSimpleDropResolver(f != null);
@@ -767,67 +766,6 @@
} else {
return new VpeVisualInnerDragInfo(element);
}
-
- // fix of JBIDE-4998
-// nsISelection selection = visualSelectionController.getSelection(
-// nsISelectionController.SELECTION_NORMAL);
-// nsIDOMNode focusNode = selection.getFocusNode();
-// nsIDOMNode anchorNode = selection.getAnchorNode();
-// //when we select input this function return null
-// //but we select elemnt
-// if(focusNode==null && anchorNode==null) {
-// nsIDOMNode visualNode =(nsIDOMNode) event.getTarget()
-// .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-// //fix of JBIDE-1097
-// if(HTML.TAG_SPAN.equalsIgnoreCase(visualNode.getNodeName())) {
-// if(visualBuilder.getXulRunnerEditor().getLastSelectedElement() != null
-// && !visualBuilder.getNodeBounds(
-// visualBuilder.getXulRunnerEditor()
-// .getLastSelectedElement())
-// .contains(VisualDomUtil.getMousePoint(event))) {
-// return null;
-// }
-// }
-// int offset = (int) VisualDomUtil.getOffset(visualNode);
-// selection.removeAllRanges();
-// selection.collapse(visualNode.getParentNode(), offset);
-// try {
-// selection.extend(visualNode.getParentNode(), offset + 1);
-// } catch(XPCOMException ex) {
-// //just ignore exception
-// // throws when we trying drag element which already resizing
-// return null;
-// }
-// focusNode = selection.getFocusNode();
-// anchorNode = selection.getAnchorNode();
-// }
-// if (focusNode != null && focusNode.equals(anchorNode)) {
-// int focusOffset = selection.getFocusOffset();
-// int anchorOffset = selection.getAnchorOffset();
-// int offset = Math.min(focusOffset, anchorOffset);
-// int length = Math.max(focusOffset, anchorOffset) - offset;
-//
-// int focusNodeType = focusNode.getNodeType();
-// if (focusNodeType == nsIDOMNode.ELEMENT_NODE) {
-// if (length == 1) {
-// nsIDOMNodeList children = focusNode.getChildNodes();
-// nsIDOMNode selectedNode = children.item(
-// Math.min(focusOffset, anchorOffset));
-// if
(visualBuilder.getNodeBounds(selectedNode).contains(VisualDomUtil.getMousePoint(event)))
{
-// int selectedNodeType = selectedNode.getNodeType();
-// if (selectedNodeType == nsIDOMNode.ELEMENT_NODE) {
-// return new
VpeVisualInnerDragInfo((nsIDOMElement)selectedNode.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
-// } else if (selectedNodeType == nsIDOMNode.TEXT_NODE) {
-// return new VpeVisualInnerDragInfo(selectedNode, 0,
selectedNode.getNodeValue().length());
-// }
-// }
-// }
-// } else if (focusNodeType == nsIDOMNode.TEXT_NODE) {
-// return new VpeVisualInnerDragInfo(focusNode, offset, length);
-// }
-// }
-//
-// return null;
}
private VpeSourceDropInfo getDropInfo(nsIDOMEvent event) {
@@ -867,552 +805,9 @@
}
return new VpeSourceDropInfo(dropContainer, dropOffset, canDrop);
-
-// nsIDOMNSUIEvent nsuiEvent = (nsIDOMNSUIEvent)
-// event.queryInterface(nsIDOMNSUIEvent.NS_IDOMNSUIEVENT_IID);
-// int mouseX = nsuiEvent.getPageX();
-// int mouseY = nsuiEvent.getPageY();
-// nsIDOMNode dropContainer = null;
-// int dropOffset = 0;
-//
-// nsIDOMDocument document = vpeController.getVisualBuilder()
-// .getOriginalTargetNode(event).getOwnerDocument();
-//
-// nsIDOMNode originalNode = DndUtil.getElementFromPoint(document, mouseX, mouseY);
-//// if (originalNode != null) {
-//// if (dropableArea == null) {
-//// dropableArea = new DropableArea(document);
-//// dropableArea.setDropSpots(EnumSet.allOf(DropSpot.class));
-//// }
-//// dropableArea.setNode(originalNode);
-//// dropableArea.setHighlightedSpot(mouseX, mouseY);
-//// dropableArea.setVisible(true);
-//// dropableArea.redraw();
-//// }
-//
-// if (originalNode == null || originalNode.getParentNode() == null ||
-// originalNode.getParentNode().getNodeType() == Node.DOCUMENT_NODE) {
-// return new VpeVisualDropInfo(null, 0);
-// }
-// if (originalNode.getNodeType() == Node.TEXT_NODE) {
-// dropContainer = nsuiEvent.getRangeParent();
-// nsIDOMNode containerForPseudoContent = VpePseudoContentCreator
-// .getContainerForPseudoContent(dropContainer);
-// if (containerForPseudoContent != null) {
-// dropContainer = containerForPseudoContent;
-// dropOffset = 0;
-// } else {
-// dropOffset = nsuiEvent.getRangeOffset();
-// }
-// } else {
-// int closestXDistance = HUGE_DISTANCE;
-// int closestYDistance = HUGE_DISTANCE;
-// boolean inNodeFlag = false;
-// nsIDOMNode closestNode = null;
-//
-// nsIDOMNodeList childen = originalNode.getChildNodes();
-// long count = childen.getLength();
-// for (long i = 0; i < count; i++) {
-// nsIDOMNode child = childen.item(i);
-// if (VpeVisualDomBuilder.isPseudoElement(child)
-// || VpeVisualDomBuilder.isAnonElement(child)) {
-// continue;
-// }
-// Rectangle rect = XulRunnerVpeUtils.getElementBounds(child);
-// int fromTop = mouseY - rect.y;
-// int fromBottom = mouseY - rect.y - rect.height;
-//
-// int yDistance;
-// if (fromTop > 0 && fromBottom < 0) {
-// yDistance = 0;
-// } else {
-// yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
-// }
-//
-// if (yDistance <= closestYDistance && rect.width > 0 &&
rect.height > 0) {
-// if (yDistance < closestYDistance) {
-// closestXDistance = HUGE_DISTANCE;
-// }
-// int fromLeft = mouseX - rect.x;
-// int fromRight = mouseX - rect.x - rect.width;
-//
-// int xDistance;
-// if (fromLeft > 0 && fromRight < 0) {
-// xDistance = 0;
-// } else {
-// xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
-// }
-// if (xDistance == 0 && yDistance == 0) {
-// closestNode = child;
-// inNodeFlag = true;
-// break;
-// }
-//
-// if (xDistance < closestXDistance || (xDistance == closestXDistance &&
rect.x <= mouseX)) {
-// closestXDistance = xDistance;
-// closestYDistance = yDistance;
-// closestNode = child;
-// }
-// }
-// }
-//
-// if (closestNode == null) {
-// closestNode = originalNode;
-// inNodeFlag = true;
-// }
-// if (inNodeFlag) {
-// if (closestNode.getNodeType() == Node.TEXT_NODE) {
-// dropContainer = nsuiEvent.getRangeParent();
-// dropOffset = nsuiEvent.getRangeOffset();
-// } else {
-// if (HTML.TAG_COLGROUP.equalsIgnoreCase(closestNode.getNodeName())) {
-// nsIDOMNode nearChild = getNearChild(closestNode, mouseX, mouseY);
-// if (nearChild != null && nearChild.getNodeType() == Node.ELEMENT_NODE) {
-// dropContainer = nearChild;
-// } else {
-// dropContainer = closestNode;
-// }
-// } else {
-// dropContainer = closestNode;
-// }
-// dropOffset = 0;
-// }
-// } else {
-// dropContainer = closestNode.getParentNode();
-// dropOffset = (int)VisualDomUtil.getOffset(closestNode);
-// Rectangle rect = XulRunnerVpeUtils.getElementBounds(closestNode);
-// if (canInsertAfter(mouseX, mouseY, rect)) {
-// dropOffset++;
-// }
-// }
-// }
}
private interface DropResolver {
public boolean canDrop(Node node);
}
-
-// TODO: delete the following methods, as they are never used
-// this method is never used
-// private boolean canInsertAfter(int x, int y, Rectangle rect) {
-// if (y > (rect.y + rect.height) || x > (rect.x + rect.width)) {
-// return true;
-// }
-// return y >= rect.x && x > (rect.x + rect.width / 2);
-// }
-
-// this method is never used
-// private MozillaDropInfo canExternalDrop(nsIDOMMouseEvent mouseEvent, String flavor,
String data) {
-// InnerDragBuffer.object = null;
-// vpeController.onHideTooltip();
-//
-// if (vpeController.getDropWindow().isActive()) {
-// if (!mouseEvent.getAltKey()) {
-// vpeController.getDropWindow().close();
-// } else {
-// return new MozillaDropInfo(false, null, 0);
-// }
-// }
-// if (mouseEvent.getAltKey()) {
-// nsIDOMNode visualNode = (nsIDOMNode) mouseEvent.getTarget()
-// .queryInterface(nsIDOMNode.NS_IDOMNODE_IID);
-// Node sourceNode = vpeController.getDomMapping().getNearSourceNode(visualNode);
-// if (sourceNode != null) {
-// if (ModelTransfer.MODEL.equals(flavor)) {
-// // XModelObject object =
-// // PreferenceModelUtilities.getPreferenceModel().
-// // getModelBuffer().source();
-// // InnerDragBuffer.object = object;
-// } else {
-// vpeController.getDropWindow().setFlavor(flavor);
-// }
-// vpeController.getDropWindow().setActive(true);
-// vpeController.getDropWindow().setEventPosition(mouseEvent.getScreenX(), mouseEvent
-// .getScreenY());
-// vpeController.getDropWindow().setInitialTargetNode(sourceNode);
-// vpeController.getDropWindow().open();
-// mouseEvent.stopPropagation();
-// mouseEvent.preventDefault();
-// return new MozillaDropInfo(false, null, 0);
-// }
-// }
-// boolean canDrop = false;
-// nsIDOMNode caretParent = null;
-// long caretOffset = 0;
-//
-// if (VpeController.MODEL_FLAVOR.equals(flavor)) {
-// XModelObject object = PreferenceModelUtilities.getPreferenceModel()
-// .getModelBuffer().source();
-// if (object.getFileType() == XModelObject.FILE
-// && !TLDUtil.isTaglib(object)) {
-// IFile f = (IFile) EclipseResourceUtil.getResource(object);
-// canDrop = f != null;
-// VpeVisualDropInfo visualDropInfo = getDropInfo(mouseEvent);
-// caretParent = visualDropInfo.getDropContainer();
-// caretOffset = visualDropInfo.getDropOffset();
-// } else {
-// String tagname = vpeController.getTagName(object);
-// if (tagname.indexOf("taglib") >= 0)tagname = "taglib";
//$NON-NLS-1$ //$NON-NLS-2$
-// Node sourceDragNode = ((Document) vpeController.getModel().getAdapter(
-// Document.class)).createElement(tagname);
-// VpeVisualDropInfo visualDropInfo = getDropInfo(mouseEvent);
-// if (visualDropInfo.getDropContainer() != null) {
-// VpeSourceDropInfo sourceDropInfo
-// = getSourceDropInfo(
-// sourceDragNode, visualDropInfo, true);
-// canDrop = sourceDropInfo.canDrop();
-// if (canDrop) {
-// VpeVisualDropInfo newVisualDropInfo
-// = getDropInfo(
-// sourceDropInfo.getContainer(),
-// sourceDropInfo.getOffset());
-// if (newVisualDropInfo != null) {
-// correctVisualDropPosition(mouseEvent,
-// newVisualDropInfo, visualDropInfo);
-// caretParent = newVisualDropInfo.getDropContainer();
-// caretOffset = newVisualDropInfo.getDropOffset();
-// }
-// }
-// }
-// visualDropInfo.release();
-// }
-// } else if (XulRunnerEditor.TRANS_FLAVOR_kFileMime.equals(flavor)
-// || XulRunnerEditor.TRANS_FLAVOR_kURLMime.equals(flavor)) {
-// VpeVisualDropInfo visualDropInfo = getDropInfo(mouseEvent);
-// caretParent = visualDropInfo.getDropContainer();
-// caretOffset = visualDropInfo.getDropOffset();
-// canDrop = true;
-//
-// }
-// if (VpeDebug.PRINT_VISUAL_INNER_DRAGDROP_EVENT) {
-// System.out.println(" canDrop: " + canDrop //$NON-NLS-1$
-// + (canDrop ?
-// " container: " //$NON-NLS-1$
-// + caretParent.getNodeName()
-// + " offset: " //$NON-NLS-1$
-// + caretOffset
-// : "")); //$NON-NLS-1$
-// }
-// return new MozillaDropInfo(canDrop, caretParent, caretOffset);
-//
-// }
-
-// this method is never used
-// private VpeSourceDropInfo getSourceDropInfo(Node dragNode,
-// Node container, int offset, boolean checkParentsTemplates) {
-// // Thread.dumpStack();
-// boolean canDrop = false;
-// switch (container.getNodeType()) {
-// case Node.ELEMENT_NODE:
-// VpeNodeMapping nodeMapping = vpeController.getDomMapping()
-// .getNodeMapping(container);
-// if (nodeMapping != null && nodeMapping instanceof VpeElementMapping) {
-// canDrop = ((VpeElementMapping) nodeMapping).getTemplate()
-// .canInnerDrop(vpeController.getPageContext(), container, dragNode);
-// }
-// if (!canDrop) {
-// if (!checkParentsTemplates)
-// return new VpeSourceDropInfo(container, offset,
-// canDrop);
-// // offset = ((NodeImpl)container).getIndex();
-// // container = container.getParentNode();
-// // TODO Max Areshkau unclear logic , if we can drop on element
-// // why we trying to drop
-// // this on parent
-// // return getSourceDropInfo(dragNode, container, offset,
-// // false);
-// return new VpeSourceDropInfo(container, offset, canDrop);
-// }
-// break;
-// case Node.TEXT_NODE:
-// case Node.DOCUMENT_NODE:
-// canDrop = true;
-// break;
-// case Node.ATTRIBUTE_NODE:
-// canDrop = true;
-// break;
-// }
-// if (canDrop) {
-// return new VpeSourceDropInfo(container, offset, canDrop);
-// } else {
-// return new VpeSourceDropInfo(null, 0, canDrop);
-// }
-// }
-
-// this method is never used
-// private VpeSourceDropInfo getSourceDropInfo(Node sourceDragNode,
-// VpeVisualDropInfo visualDropInfo, boolean checkParentTemplates) {
-// nsIDOMNode visualDropContainer = visualDropInfo.getDropContainer();
-// long visualDropOffset = visualDropInfo.getDropOffset();
-// Node sourceDropContainer = null;
-// int sourceDropOffset = 0;
-//
-// switch (visualDropContainer.getNodeType()) {
-// case nsIDOMNode.ELEMENT_NODE:
-// nsIDOMNode visualOffsetNode = null;
-// boolean afterFlag = false;
-// long visualChildCount = VisualDomUtil
-// .getChildCount(visualDropContainer);
-// if (visualDropOffset < visualChildCount) {
-// visualOffsetNode = VisualDomUtil.getChildNode(
-// visualDropContainer, visualDropOffset);
-// if (VpeVisualDomBuilder.isPseudoElement(visualOffsetNode)
-// || VpeVisualDomBuilder.isAnonElement(visualOffsetNode)) {
-// visualOffsetNode = VpeVisualDomBuilder
-// .getLastAppreciableVisualChild(visualDropContainer);
-// afterFlag = true;
-// }
-// } else {
-// visualOffsetNode =
VpeVisualDomBuilder.getLastAppreciableVisualChild(visualDropContainer);
-// afterFlag = visualChildCount != 0;
-// }
-// if (visualOffsetNode != null) {
-// Node sourceOffsetNode = vpeController.getDomMapping()
-// .getSourceNode(visualOffsetNode);
-// if (sourceOffsetNode != null) {
-// sourceDropContainer = sourceOffsetNode.getParentNode();
-// sourceDropOffset = ((NodeImpl) sourceOffsetNode).getIndex();
-// if (afterFlag) {
-// sourceDropOffset++;
-// }
-// }
-// }
-// if (sourceDropContainer == null) {
-// sourceDropContainer = vpeController.getDomMapping()
-// .getNearSourceNode(visualDropContainer);
-// if (sourceDropContainer != null) {
-// sourceDropOffset = sourceDropContainer.getChildNodes()
-// .getLength();
-// }
-// }
-// if (sourceDropContainer == null) {
-// sourceDropContainer = vpeController.getDomMapping()
-// .getNearSourceNode(
-// vpeController.getVisualBuilder().getContentArea());
-// sourceDropOffset = sourceDropContainer.getChildNodes()
-// .getLength();
-// }
-// break;
-// case nsIDOMNode.TEXT_NODE:
-// VpeNodeMapping nodeMapping = vpeController.getDomMapping()
-// .getNearNodeMapping(visualDropContainer);
-// // switch (nodeMapping.getType()) {
-// // case VpeNodeMapping.TEXT_MAPPING:
-// sourceDropContainer = nodeMapping.getSourceNode();
-// sourceDropOffset = TextUtil.sourceInnerPosition(sourceDropContainer
-// .getNodeValue(), visualDropOffset);
-// // break;
-// // case VpeNodeMapping.ELEMENT_MAPPING:
-// // it's attribute
-// if (VpeVisualDomBuilder.isTextEditable(visualDropContainer)) {
-// String[] atributeNames = ((VpeElementMapping) nodeMapping)
-// .getTemplate().getOutputAttributeNames();
-// if (atributeNames != null && atributeNames.length > 0) {
-// Element sourceElement = (Element) nodeMapping
-// .getSourceNode();
-// sourceDropContainer = sourceElement
-// .getAttributeNode(atributeNames[0]);
-// sourceDropOffset = TextUtil.sourceInnerPosition(
-// sourceDropContainer.getNodeValue(),
-// visualDropOffset);
-// }
-// }
-// }
-// if (sourceDropContainer != null) {
-// return getSourceDropInfo(sourceDragNode, sourceDropContainer,
-// sourceDropOffset, checkParentTemplates);
-// } else {
-// return new VpeSourceDropInfo(null, 0, false);
-// }
-// }
-
-// this method is never used
-// private void correctVisualDropPosition(nsIDOMMouseEvent mouseEvent,
-// VpeVisualDropInfo newVisualDropInfo,
-// VpeVisualDropInfo oldVisualDropInfo) {
-// nsIDOMNode newVisualDropContainer = newVisualDropInfo
-// .getDropContainer();
-// nsIDOMNode oldVisualDropContainer = oldVisualDropInfo
-// .getDropContainer();
-//
-// if (newVisualDropContainer.equals(oldVisualDropContainer)) {
-// newVisualDropInfo.setDropOffset(oldVisualDropInfo.getDropOffset());
-// return;
-// }
-//
-// nsIDOMNode child = oldVisualDropContainer;
-// while (child != null && child.getNodeType() != Node.DOCUMENT_NODE) {
-// nsIDOMNode parent = child.getParentNode();
-// if (newVisualDropContainer.equals(parent)) {
-// long offset = VisualDomUtil.getOffset(child);
-// Rectangle rect = XulRunnerVpeUtils.getElementBounds(child);
-//
-// nsIDOMNSUIEvent nsuiEvent = (nsIDOMNSUIEvent)
-// mouseEvent.queryInterface(nsIDOMNSUIEvent.NS_IDOMNSUIEVENT_IID);
-// int mouseX = nsuiEvent.getPageX();
-// int mouseY = nsuiEvent.getPageY();
-//
-// if (canInsertAfter(mouseX, mouseY, rect)) {
-// offset++;
-// }
-// newVisualDropInfo.setDropOffset(offset);
-// }
-// child = parent;
-// }
-// }
-
-// this method is never used
-// private VpeVisualDropInfo getDropInfo(Node sourceDropContainer,
-// int sourceDropOffset) {
-// nsIDOMNode visualDropContainer = null;
-// long visualDropOffset = 0;
-//
-// switch (sourceDropContainer.getNodeType()) {
-// case Node.TEXT_NODE:
-// visualDropContainer =
vpeController.getDomMapping().getVisualNode(sourceDropContainer);
-// visualDropOffset = TextUtil.visualInnerPosition(sourceDropContainer
-// .getNodeValue(), sourceDropOffset);
-// break;
-// case Node.ELEMENT_NODE:
-// case Node.DOCUMENT_NODE:
-// NodeList sourceChildren = sourceDropContainer.getChildNodes();
-// if (sourceDropOffset < sourceChildren.getLength()) {
-// Node sourceChild = sourceChildren.item(sourceDropOffset);
-// nsIDOMNode visualChild = vpeController.getDomMapping().getVisualNode(sourceChild);
-// if (visualChild != null) {
-// visualDropContainer = visualChild.getParentNode();
-//
-// visualDropOffset = VisualDomUtil.getOffset(visualChild);
-// }
-// }
-// if (visualDropContainer == null) {
-// visualDropContainer = vpeController.getDomMapping()
-// .getNearVisualNode(sourceDropContainer);
-// nsIDOMNode visualChild =
VpeVisualDomBuilder.getLastAppreciableVisualChild(visualDropContainer);
-// if (visualChild != null) {
-// visualDropOffset = VisualDomUtil.getOffset(visualChild) + 1;
-// } else {
-// visualDropOffset = 0;
-// }
-// }
-// break;
-// case Node.ATTRIBUTE_NODE:
-// Element sourceElement = ((Attr) sourceDropContainer)
-// .getOwnerElement();
-// VpeElementMapping elementMapping = vpeController.getDomMapping()
-// .getNearElementMapping(sourceElement);
-// nsIDOMNode textNode = elementMapping.getTemplate()
-// .getOutputTextNode(vpeController.getPageContext(), sourceElement,
-// elementMapping.getData());
-// if (textNode != null) {
-// visualDropContainer = textNode;
-// visualDropOffset = TextUtil.visualInnerPosition(
-// sourceDropContainer.getNodeValue(), sourceDropOffset);
-// }
-// break;
-// }
-// if (visualDropContainer == null) {
-// return null;
-// }
-// return new VpeVisualDropInfo(visualDropContainer, visualDropOffset);
-// }
-
-// this method is never used
-// private nsIDOMNode getNearChild(nsIDOMNode container, int x, int y) {
-// int closestXDistance = HUGE_DISTANCE;
-// int closestYDistance = HUGE_DISTANCE;
-// nsIDOMNode closestNode = null;
-//
-// nsIDOMNodeList childen = container.getChildNodes();
-// long count = childen.getLength();
-// for (long i = 0; i < count; i++) {
-// nsIDOMNode child = childen.item(i);
-// if (VpeVisualDomBuilder.isPseudoElement(child) ||
VpeVisualDomBuilder.isAnonElement(child)) {
-// continue;
-// }
-// Rectangle rect = XulRunnerVpeUtils.getElementBounds(child);
-// int fromTop = y - rect.y;
-// int fromBottom = y - rect.y - rect.height;
-//
-// int yDistance;
-// if (fromTop > 0 && fromBottom < 0) {
-// yDistance = 0;
-// } else {
-// yDistance = Math.min(Math.abs(fromTop), Math.abs(fromBottom));
-// }
-//
-// if (yDistance <= closestYDistance && rect.width > 0 &&
rect.height > 0) {
-// if (yDistance < closestYDistance) {
-// closestXDistance = HUGE_DISTANCE;
-// }
-// int fromLeft = x - rect.x;
-// int fromRight = x - rect.x - rect.width;
-//
-// int xDistance;
-// if (fromLeft > 0 && fromRight < 0) {
-// xDistance = 0;
-// } else {
-// xDistance = Math.min(Math.abs(fromLeft), Math.abs(fromRight));
-// }
-// if (xDistance == 0 && yDistance == 0) {
-// closestNode = child;
-// break;
-// }
-// if (xDistance < closestXDistance || (xDistance == closestXDistance &&
rect.x <= x)) {
-// closestXDistance = xDistance;
-// closestYDistance = yDistance;
-// closestNode = child;
-// }
-// }
-// }
-// return closestNode;
-// }
-
-// this method is never used
-// public VpeSourceDropInfo canExternalDropMacro(XModelObject object, Node parentNode,
int offset) {
-// String tagname = vpeController.getTagName(object);
-// Node sourceDragNode = ((Document)
vpeController.getModel().getAdapter(Document.class))
-// .createElement(tagname);
-// return vpeController.getVisualBuilder().getSourceDropInfo(sourceDragNode,
parentNode,
-// offset, false);
-// }
-
-// this method is never used
-// public void _dragOver(nsIDOMEvent event) {
-// if (!vpeController.getSwitcher()
-// .startActiveEditor(VpeController.ActiveEditorSwitcher.ACTIVE_EDITOR_VISUAL)) {
-// return;
-// }
-// try {
-// if (VpeDebug.PRINT_VISUAL_DRAGDROP_EVENT) {
-// System.out.println("<<<<<<<<<<<<<<<<<<<<
dragOver"); //$NON-NLS-1$
-// }
-// // browser.computeDropPosition(event);
-// boolean canDrop = !vpeController.getXulRunnerEditor().isMozillaDragFlavor();
-// if (canDrop) {
-// Clipboard clipboard = new Clipboard(Display.getCurrent());
-// canDrop = clipboard.getContents(ModelTransfer.getInstance()) != null;
-// }
-// if (canDrop) {
-// canDrop = VpeDndUtil.isDropEnabled((IModelObjectEditorInput)
-// vpeController.getSourceEditor().getEditorInput());
-// }
-// if (canDrop) {
-// VpeVisualCaretInfo caretInfo = vpeController.getSelectionBuilder()
-// .getVisualCaretInfo(event);
-// canDrop = caretInfo.exist();
-// if (canDrop) {
-// caretInfo.showCaret();
-// } else {
-// caretInfo.hideCaret();
-// }
-// }
-// if (!canDrop) {
-// event.stopPropagation();
-// event.preventDefault();
-// }
-// } finally {
-// vpeController.getSwitcher().stopActiveEditor();
-// }
-// }
}