From f7797140ef8a87df02dfbdcfa2ac94c28f8f7d00 Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Tue, 3 Nov 2015 15:25:24 +0300 Subject: [PATCH] IDEA-147259 "Find Usages" popup is 2 pixels too small, showing unnecessary scrollbar --- .../src/com/intellij/find/actions/ShowUsagesAction.java | 3 ++- .../src/com/intellij/ui/popup/AbstractPopup.java | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java index 7860445f9ccf..06a7f3fbb140 100644 --- a/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java +++ b/platform/lang-impl/src/com/intellij/find/actions/ShowUsagesAction.java @@ -1075,7 +1075,8 @@ public class ShowUsagesAction extends AnAction implements PopupAction { int footer = footerSize.height; int footerBorder = footer == 0 ? 0 : 1; - rectangle.height += headerSize.height + footer + footerBorder; + Insets insets = ((AbstractPopup)popup).getPopupBorder().getBorderInsets(content); + rectangle.height += headerSize.height + footer + footerBorder + insets.top + insets.bottom; ScreenUtil.fitToScreen(rectangle); Dimension newDim = rectangle.getSize(); window.setBounds(rectangle); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index eb2396f873d4..fee50ce87fab 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -395,6 +395,11 @@ public class AbstractPopup implements JBPopup { setAdText(s, SwingConstants.LEFT); } + @NotNull + public PopupBorder getPopupBorder() { + return myPopupBorder; + } + @Override public void setAdText(@NotNull final String s, int alignment) { if (myAdComponent == null) {