boolean (@NotNull com.intellij.ide.plugins.PluginEnabler pluginEnabler, @NotNull List<? extends IdeaPluginDescriptor> list) { Set<IdeaPluginDescriptor> disabled = new HashSet<>(); Set<IdeaPluginDescriptor> disabledDependants = new HashSet<>(); for (IdeaPluginDescriptor node : list) { PluginId pluginId = node.getPluginId(); if (pluginEnabler.isDisabled(pluginId)) { disabled.add(node); } for (IdeaPluginDependency dependency : node.getDependencies()) { if (dependency.isOptional()) { continue; } PluginId dependantId = dependency.getPluginId(); // If there is no installed plugin implementing the module, then it can only be a platform module that cannot be disabled if (PluginManagerCore.isModuleDependency(dependantId) && PluginManagerCore.INSTANCE.findPluginByModuleDependency(dependantId) == null) { continue; } IdeaPluginDescriptor pluginDescriptor = PluginManagerCore.getPlugin(dependantId); if (pluginDescriptor != null && pluginEnabler.isDisabled(dependantId)) { disabledDependants.add(pluginDescriptor); } } } if (!disabled.isEmpty() || !disabledDependants.isEmpty()) { String message = ""; if (disabled.size() == 1) { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part1", disabled.iterator().next().getName()); } else if (!disabled.isEmpty()) { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part2", StringUtil.join(disabled, pluginDescriptor -> pluginDescriptor.getName(), ", ")); } if (!disabledDependants.isEmpty()) { message += "<br>"; message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part3", list.size()); message += " "; if (disabledDependants.size() == 1) { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part4", disabledDependants.iterator().next().getName()); } else { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part5", StringUtil.join(disabledDependants, pluginDescriptor -> pluginDescriptor.getName(), ", ")); } } message += " "; message += IdeBundle.message(disabled.isEmpty() ? "plugin.manager.main.suggest.to.enable.message.part6" : "plugin.manager.main.suggest.to.enable.message.part7"); boolean result; if (!disabled.isEmpty() && !disabledDependants.isEmpty()) { Integer codeHeadless = PluginUtilsKt.getEnableDisabledPluginsDependentConfirmationData(); int code = codeHeadless != null ? codeHeadless : MessageDialogBuilder.yesNoCancel(IdeBundle.message("dialog.title.dependent.plugins.found"), XmlStringUtil.wrapInHtml(message)) .yesText(IdeBundle.message("button.enable.all")) .noText(IdeBundle.message("button.enable.updated.plugins", disabled.size())) .guessWindowAndAsk(); if (code == Messages.CANCEL) { return false; } result = code == Messages.YES; } else { message += "<br>"; if (!disabled.isEmpty()) { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part8", disabled.size()); } else { message += IdeBundle.message("plugin.manager.main.suggest.to.enable.message.part9", disabledDependants.size()); } message += "?"; Integer codeHeadless = PluginUtilsKt.getEnableDisabledPluginsDependentConfirmationData(); result = codeHeadless != null ? codeHeadless.equals(Messages.YES) : MessageDialogBuilder.yesNo(IdeBundle.message("dialog.title.dependent.plugins.found"), XmlStringUtil.wrapInHtml(message)).guessWindowAndAsk(); if (!result) { return false; } } if (result) { disabled.addAll(disabledDependants); pluginEnabler.enable(disabled); } else if (!disabled.isEmpty()) { pluginEnabler.enable(disabled); } return true; } return false; }