RelativePoint (@NotNull AnAction action, @Nullable Component contextComponent) { var c = contextComponent; ActionToolbar toolbar = null; while (c != null && (c = c.getParent()) != null) { if (c instanceof JComponent && (toolbar = (ActionToolbar)((JComponent)c).getClientProperty(ActionToolbar.ACTION_TOOLBAR_PROPERTY_KEY)) != null) { break; } } if (toolbar instanceof JComponent) { RelativePoint preferredPoint = computePreferredPopupPoint((JComponent)toolbar, action); if (preferredPoint != null) return preferredPoint; } return null; }