void (@NotNull AnActionEvent e, boolean selected) { final Project project = findProject(); if (project == null) { return; } final JFrame projectFrame = WindowManager.getInstance().getFrame(project); if (projectFrame == null) { return; } final int frameState = projectFrame.getExtendedState(); if (SystemInfo.isMac && BitUtil.isSet(projectFrame.getExtendedState(), Frame.ICONIFIED) && e.getInputEvent() instanceof KeyEvent) { // On Mac minimized window should not be restored this way return; } if (BitUtil.isSet(frameState, Frame.ICONIFIED)) { // restore the frame if it is minimized projectFrame.setExtendedState(BitUtil.set(frameState, Frame.ICONIFIED, false)); } projectFrame.toFront(); IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> { Component mostRecentFocusOwner = projectFrame.getMostRecentFocusOwner(); if (mostRecentFocusOwner != null) { IdeFocusManager.getGlobalInstance().requestFocus(mostRecentFocusOwner, true); } }); }