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
This commit is contained in:
Kate Botsman
2023-11-28 21:17:45 +00:00
committed by intellij-monorepo-bot
parent 86b5a9a93d
commit c33c4aa44f
@@ -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<GotoRelatedItem> 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)