private List<String> getNonOptionalDependencies(final String id) { List<String> result = new ArrayList<String>(); IdeaPluginDescriptor descriptor = findPlugin(id); if (descriptor != null) { for (PluginId pluginId : descriptor.getDependentPluginIds()) { if (pluginId.getIdString().equals("com.intellij")) continue; if (!ArrayUtil.contains(pluginId, descriptor.getOptionalDependentPluginIds())) { result.add(pluginId.getIdString()); } } } return result; }
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); } } } }