void (@NotNull AnActionEvent initEvent, Project project, JBPopup balloon) { if (initEvent.getPlace().equals(ActionPlaces.RUN_TOOLBAR_LEFT_SIDE)) { var component = (Component)initEvent.getInputEvent().getSource(); balloon.setLocation(component.getLocationOnScreen()); ((AbstractPopup)balloon).show(component, 0, 0, true); return; } Point savedLocation = getStateService().getLocation(LOCATION_SETTINGS_KEY); //for first show and short mode popup should be shifted to the top screen half if (savedLocation == null && mySearchEverywhereUI.getViewType() == BigPopupUI.ViewType.SHORT) { Window window = project != null ? WindowManager.getInstance().suggestParentWindow(project) : KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); Component parent = UIUtil.findUltimateParent(window); if (parent != null) { JComponent content = balloon.getContent(); Dimension balloonSize = content.getPreferredSize(); Point screenPoint = new Point((parent.getSize().width - balloonSize.width) / 2, parent.getHeight() / 4 - balloonSize.height / 2); SwingUtilities.convertPointToScreen(screenPoint, parent); Rectangle screenRectangle = ScreenUtil.getScreenRectangle(screenPoint); Insets insets = content.getInsets(); int bottomEdge = screenPoint.y + mySearchEverywhereUI.getExpandedSize().height + insets.bottom + insets.top; int shift = bottomEdge - (int)screenRectangle.getMaxY(); if (shift > 0) { screenPoint.y = Integer.max(screenPoint.y - shift, screenRectangle.y); } RelativePoint showPoint = new RelativePoint(screenPoint); balloon.show(showPoint); return; } } if (project != null) { balloon.showCenteredInCurrentWindow(project); } else { balloon.showInFocusCenter(); } }