boolean (@Nullable Project project, @Nullable Component component) { if (component == null) return false; Component ideFocusOwner = IdeFocusManager.getInstance(project).getFocusOwner(); if (ideFocusOwner != null && SwingUtilities.isDescendingFrom(ideFocusOwner, component)) return true; Component jdkFocusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (jdkFocusOwner != null && SwingUtilities.isDescendingFrom(jdkFocusOwner, component)) return true; return false; }