boolean (@NotNull AnAction action) { ActionManager actionManager = ActionManager.getInstance(); ActionGroup fileGroup = (ActionGroup)actionManager.getAction(IdeActions.GROUP_FILE); if (!ActionUtil.anyActionFromGroupMatches(fileGroup, false, child -> child instanceof NewActionGroup)) return false; AnAction newProjectOrModuleGroup = ActionManager.getInstance().getAction(PROJECT_OR_MODULE_GROUP_ID); if (newProjectOrModuleGroup instanceof ActionGroup && ActionUtil.anyActionFromGroupMatches((ActionGroup)newProjectOrModuleGroup, false,Predicate.isEqual(action))) { return true; } ActionGroup newGroup = (ActionGroup)actionManager.getAction(IdeActions.GROUP_NEW); return ActionUtil.anyActionFromGroupMatches(newGroup, false, Predicate.isEqual(action)); }