boolean (@NotNull PluginEnabler pluginEnabler, @Nullable JComponent parentComponent) { EnumMap<PluginEnableDisableAction, List<IdeaPluginDescriptor>> descriptorsByAction = new EnumMap<>(PluginEnableDisableAction.class); for (Map.Entry<IdeaPluginDescriptor, Pair<PluginEnableDisableAction, PluginEnabledState>> entry : myDiff.entrySet()) { IdeaPluginDescriptor descriptor = entry.getKey(); PluginId pluginId = descriptor.getPluginId(); Pair<PluginEnableDisableAction, PluginEnabledState> pair = entry.getValue(); PluginEnabledState oldState = pair.getSecond(); PluginEnabledState newState = getState(pluginId); if (isDeleted(descriptor) || (isHiddenImplementationDetail(descriptor) && newState.isDisabled()) || !isLoaded(pluginId) /* if enableMap contains null for id => enable/disable checkbox don't touch */) { continue; } if (oldState != newState || newState.isDisabled() && myErrorPluginsToDisable.contains(pluginId)) { descriptorsByAction .computeIfAbsent(pair.getFirst(), __ -> new ArrayList<>()) .add(descriptor); } } boolean appliedWithoutRestart = true; for (Map.Entry<PluginEnableDisableAction, List<IdeaPluginDescriptor>> entry : descriptorsByAction.entrySet()) { boolean enable = entry.getKey().isEnable(); List<IdeaPluginDescriptor> descriptors = entry.getValue(); boolean applied; if (pluginEnabler instanceof DynamicPluginEnabler dynamicPluginEnabler) { Project project = getProject(); applied = enable ? dynamicPluginEnabler.enable(descriptors, project) : dynamicPluginEnabler.disable(descriptors, project, parentComponent); } else { applied = enable ? pluginEnabler.enable(descriptors) : pluginEnabler.disable(descriptors); } appliedWithoutRestart &= applied; } return appliedWithoutRestart; }