diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurableNew.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurableNew.java index f30a9025cbfd..271df59295dc 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurableNew.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginManagerConfigurableNew.java @@ -663,30 +663,31 @@ public class PluginManagerConfigurableNew @Override public void apply() throws ConfigurationException { - Map> dependencies = new HashMap<>(myPluginsModel.getDependentToRequiredListMap()); + Map enabledMap = myPluginsModel.getEnabledMap(); + List dependencies = new ArrayList<>(); - for (Iterator>> I = dependencies.entrySet().iterator(); I.hasNext(); ) { - Entry> entry = I.next(); - boolean hasNonModuleDeps = false; + for (Entry> entry : myPluginsModel.getDependentToRequiredListMap().entrySet()) { + PluginId id = entry.getKey(); - for (PluginId pluginId : entry.getValue()) { - if (!PluginManagerCore.isModuleDependency(pluginId)) { - hasNonModuleDeps = true; + if (enabledMap.get(id) == null) { + continue; + } + + for (PluginId dependId : entry.getValue()) { + if (!PluginManagerCore.isModuleDependency(dependId)) { + IdeaPluginDescriptor descriptor = PluginManager.getPlugin(id); + if (!(descriptor instanceof IdeaPluginDescriptorImpl) || !((IdeaPluginDescriptorImpl)descriptor).isDeleted()) { + dependencies.add("\"" + (descriptor == null ? id.getIdString() : descriptor.getName()) + "\""); + } break; } } - if (!hasNonModuleDeps) { - I.remove(); - } } if (!dependencies.isEmpty()) { throw new ConfigurationException("Unable to apply changes: plugin" + (dependencies.size() == 1 ? " " : "s ") + - StringUtil.join(dependencies.keySet(), pluginId -> { - IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId); - return "\"" + (descriptor == null ? pluginId.getIdString() : descriptor.getName()) + "\""; - }, ", ") + + StringUtil.join(dependencies, ", ") + " won't be able to load."); } @@ -697,7 +698,7 @@ public class PluginManagerConfigurableNew } List disableIds = new ArrayList<>(); - for (Entry entry : myPluginsModel.getEnabledMap().entrySet()) { + for (Entry entry : enabledMap.entrySet()) { Boolean enabled = entry.getValue(); if (enabled != null && !enabled) { disableIds.add(entry.getKey().getIdString()); @@ -728,11 +729,10 @@ public class PluginManagerConfigurableNew for (int i = 0; i < rowCount; i++) { IdeaPluginDescriptor descriptor = myPluginsModel.getObjectAt(i); - PluginId pluginId = descriptor.getPluginId(); - boolean enabledInTable = myPluginsModel.isEnabled(pluginId); + boolean enabledInTable = myPluginsModel.isEnabled(descriptor); if (descriptor.isEnabled() != enabledInTable) { - if (enabledInTable && !disabledPlugins.contains(pluginId.getIdString())) { + if (enabledInTable && !disabledPlugins.contains(descriptor.getPluginId().getIdString())) { continue; // was disabled automatically on startup } return true;