From 5fbfe0acce04e46a749d520d559dbbfd61d1cbed Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Tue, 6 Oct 2015 16:30:52 +0300 Subject: [PATCH] The area below a tree shouldn't be active for DnD [^vassiliy] --- .../impl/ProjectViewDropTarget.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java index 1e4593f2343d..de7b7d36c2b5 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,16 +80,11 @@ class ProjectViewDropTarget implements DnDNativeTarget { final Point point = event.getPoint(); final TreeNode targetNode = getTargetNode(point); - if (targetNode == null || (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) { - return false; - } - else if (sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorAvailable(event)) { - return false; - } - else if (sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1) { - return false; - } - else if (sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) { + if (targetNode == null || + (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0 || + sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorAvailable(event) || + sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1 || + sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) { return false; } @@ -113,6 +108,7 @@ class ProjectViewDropTarget implements DnDNativeTarget { } final Rectangle pathBounds = myTree.getPathBounds(myTree.getClosestPathForLocation(point.x, point.y)); + if (pathBounds != null && pathBounds.y + pathBounds.height < point.y) return false; event.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE); event.setDropPossible(true); return false;