public void showInFocusCenter() { final Component focused = getWndManager().getFocusedComponent(myProject); if (focused != null) { showInCenterOf(focused); } else { final JFrame frame = WindowManager.getInstance().getFrame(myProject); showInCenterOf(frame.getRootPane()); } }
public void showCenteredInCurrentWindow(@NotNull Project project) { Window window = null; Component focusedComponent = getWndManager().getFocusedComponent(project); if (focusedComponent != null) { Component parent = UIUtil.findUltimateParent(focusedComponent); if (parent instanceof Window) { window = (Window) parent; } } if (window == null) { window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); } if (window != null) { showInCenterOf(window); } }