void (@NotNull Function<? super Window, ? extends Window> mapWindow) { Window w = WindowManagerEx.getInstanceEx().getMostRecentFocusedWindow(); if (!ActiveWindowsWatcher.isTheCurrentWindowOnTheActivatedList(w)) { assert w != null; Window window = w; while (SwingUtilities.getWindowAncestor(window) != null && window != SwingUtilities.getWindowAncestor(window)) { window = SwingUtilities.getWindowAncestor(window); } if (!ActiveWindowsWatcher.isTheCurrentWindowOnTheActivatedList(window)) { if (AppUIUtil.isInFullScreen(window)) { switchFullScreenFrame((JFrame)window); } return; } Window mappedWindow = mapWindow.fun(window); Component recentFocusOwner = mappedWindow.getMostRecentFocusOwner(); (recentFocusOwner == null || !recentFocusOwner.isFocusable() ? mappedWindow : recentFocusOwner).requestFocus(); } else { Window mappedWindow = mapWindow.fun(w); Component recentFocusOwner = mappedWindow.getMostRecentFocusOwner(); (recentFocusOwner == null || !recentFocusOwner.isFocusable() ? mappedWindow : recentFocusOwner).requestFocus(); } }