public static void togglePluginState(@NotNull Collection<? extends IdeaPluginDescriptor> descriptors,
                                       boolean enable) {
    if (descriptors.isEmpty()) {
      return;
    }

    Map<PluginId, IdeaPluginDescriptorImpl> pluginIdMap = PluginManagerCore.INSTANCE.buildPluginIdMap();
    Collection<? extends IdeaPluginDescriptor> autoSwitchedDescriptors = enable ?
                                                                         getDependenciesToEnable(descriptors, pluginIdMap) :
                                                                         getDependentsToDisable(descriptors, pluginIdMap);

    PluginEnabler pluginEnabler = PluginEnabler.getInstance();
    boolean appliedWithoutRestart = enable ?
                                    pluginEnabler.enable(autoSwitchedDescriptors) :
                                    pluginEnabler.disable(autoSwitchedDescriptors);

    if (autoSwitchedDescriptors.size() > descriptors.size()) {
      String content =
        IdeBundle.message(enable ? "plugins.auto.enabled.notification.content" : "plugins.auto.disabled.notification.content",
                          MyPluginModel.joinPluginNamesOrIds(MyPluginModel.getPluginNames(descriptors)),
                          MyPluginModel.joinPluginNamesOrIds(MyPluginModel.getPluginNames(autoSwitchedDescriptors)));

      showAutoSwitchNotification(autoSwitchedDescriptors, pluginEnabler, content, enable);
    }

    notifyIfRestartRequired(!appliedWithoutRestart);
  }
public static void togglePluginState(@NotNull Collection<? extends IdeaPluginDescriptor> descriptors,
                                       boolean enable)