dnd: do not accept redundant

This commit is contained in:
anna
2010-10-08 19:58:48 +04:00
parent afed5ca652
commit 3e84270a99
@@ -81,6 +81,16 @@ class ProjectViewDropTarget implements DnDNativeTarget {
else if (sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) {
return false;
}
if (sourceNodes != null) {
boolean redundant = true;
for (TreeNode sourceNode : sourceNodes) {
if (!dropHandler.isDropRedundant(sourceNode, targetNode)) {
redundant = false;
break;
}
}
if (redundant) return false;
}
final Rectangle pathBounds = myTree.getPathBounds(myTree.getPathForLocation(point.x, point.y));
aEvent.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE );
aEvent.setDropPossible(true, null);