From 65902eb54e03e02729af1f112fee7478ed90eb47 Mon Sep 17 00:00:00 2001 From: Konstantin Aleev Date: Thu, 4 May 2017 14:30:34 +0300 Subject: [PATCH] Do not cover list cell content by tooltip balloon --- .../src/com/intellij/ide/IdeTooltipManager.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java index ecb5bd7750ae..a62211efeaf2 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java @@ -188,15 +188,22 @@ public class IdeTooltipManager implements Disposable, AWTEventListener, Applicat int shift = centerStrict ? 0 : centerDefault ? 4 : 0; // Balloon may appear exactly above useful content, such behavior is rather annoying. + Rectangle rowBounds = null; if (c instanceof JTree) { TreePath path = ((JTree)c).getClosestPathForLocation(me.getX(), me.getY()); if (path != null) { - Rectangle pathBounds = ((JTree)c).getPathBounds(path); - if (pathBounds != null && pathBounds.y + 4 < me.getY()) { - shift += me.getY() - pathBounds.y - 4; - } + rowBounds = ((JTree)c).getPathBounds(path); } } + else if (c instanceof JList) { + int row = ((JList)c).locationToIndex(me.getPoint()); + if (row > -1) { + rowBounds = ((JList)c).getCellBounds(row, row); + } + } + if (rowBounds != null && rowBounds.y + 4 < me.getY()) { + shift += me.getY() - rowBounds.y - 4; + } queueShow(comp, me, centerStrict || centerDefault, shift, -shift, -shift); }