Example #1
0
 private void collectInvolvedIds(final String pluginId, boolean toEnable, Set<String> ids) {
   ids.add(pluginId);
   if (toEnable) {
     for (String id : getNonOptionalDependencies(pluginId)) {
       collectInvolvedIds(id, true, ids);
     }
   } else {
     Condition<PluginId> condition =
         new Condition<PluginId>() {
           @Override
           public boolean value(PluginId id) {
             return pluginId.equals(id.getIdString());
           }
         };
     for (final IdeaPluginDescriptor plugin : myAllPlugins) {
       if (null != ContainerUtil.find(plugin.getDependentPluginIds(), condition)
           && null == ContainerUtil.find(plugin.getOptionalDependentPluginIds(), condition)) {
         collectInvolvedIds(plugin.getPluginId().getIdString(), false, ids);
       }
     }
   }
 }
Example #2
0
 void setPluginEnabledWithDependencies(final String pluginId, boolean enabled) {
   initIfNeed();
   Set<String> ids = new HashSet<String>();
   collectInvolvedIds(pluginId, enabled, ids);
   Set<IdSet> sets = new HashSet<IdSet>();
   for (String id : ids) {
     IdSet set = getSet(id);
     if (set != null) {
       sets.add(set);
     }
   }
   for (IdSet set : sets) {
     ids.addAll(Arrays.asList(set.getIds()));
   }
   for (String id : ids) {
     if (enabled) {
       myDisabledPluginIds.remove(id);
     } else {
       myDisabledPluginIds.add(id);
     }
   }
 }