From c33c4aa44f24cdec4b1309c51bc9beeae19f629f Mon Sep 17 00:00:00 2001 From: Kate Botsman Date: Tue, 28 Nov 2023 17:49:15 +0100 Subject: [PATCH] GTW-6993 Fix Related symbols popup is shown in the wrong position in RD In RD `guessBestPopupLocation` returns `ClientRelativePoint` which is processed in a special way to ensure popup position is properly calculated. Replacing this point with standard `RelativePoint` causes popup to be shown in the wrong position. In `GotoRelatedSymbolAction` however there is no need to replace the `ClientRelativePoint` with `RelativePoint` as `popupLocation.getPoint().translate` alters the actual point (not its copy) therefore `new RelativePoint` may be safely removed GitOrigin-RevId: 42d7d31e59a0c4129e91333344bc721ceb4be4ab --- .../src/com/intellij/ide/actions/GotoRelatedSymbolAction.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java index b8e9cdddf03f..16e806f5dc4e 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java @@ -46,7 +46,7 @@ public final class GotoRelatedSymbolAction extends AnAction { // it's calculated in advance because `NavigationUtil.collectRelatedItems` might be // calculated under a cancellable progress, and we can't use the data context anymore, // since it can't be reused between swing events - RelativePoint popupLocation = JBPopupFactory.getInstance().guessBestPopupLocation(dataContext); + final RelativePoint popupLocation = JBPopupFactory.getInstance().guessBestPopupLocation(dataContext); List items = NavigationUtil.collectRelatedItems(element, dataContext); if (items.isEmpty()) { @@ -54,7 +54,6 @@ public final class GotoRelatedSymbolAction extends AnAction { if (component instanceof EditorComponentImpl editor) { Point point = popupLocation.getPoint(); point.translate(0, -editor.getEditor().getLineHeight()); - popupLocation = new RelativePoint(popupLocation.getComponent(), point); } JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(LangBundle.message("hint.text.no.related.symbols"), MessageType.ERROR, null)