Component () { assertDispatchThread(); Component result = null; if (!ApplicationManager.getApplication().isActive()) { IdeFrame frame = getLastFocusedFrame(); if (frame != null) { LOG.assertTrue(frame instanceof Window); result = myLastFocusedAtDeactivation.get(frame); } } else if (myRunContext != null) { result = myRunContext.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); } if (result == null) { result = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); } if (result == null) { final Component permOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getPermanentFocusOwner(); if (permOwner != null) { result = permOwner; } if (ComponentUtil.isMeaninglessFocusOwner(result)) { result = KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow(); } } return result; }