Component (@NotNull Component component) { Window window = ComponentUtil.getWindow(component); Component focusedComponent = window == null ? null : WindowManagerEx.getInstanceEx().getFocusedComponent(window); return focusedComponent != null ? focusedComponent : component; }