private static @NotNull List<IdeaPluginDescriptorImpl> getDependenciesToEnable(@NotNull Collection<IdeaPluginDescriptorImpl> descriptors,
                                                                                 @NotNull Map<PluginId, PluginEnabledState> enabledMap,
                                                                                 @NotNull Map<PluginId, IdeaPluginDescriptorImpl> pluginIdMap) {
    ArrayList<IdeaPluginDescriptorImpl> result = new ArrayList<>();
    for (IdeaPluginDescriptorImpl descriptor : descriptors) {
      PluginManagerCore.INSTANCE.processAllNonOptionalDependencies(descriptor, pluginIdMap, dependency -> {
        PluginId dependencyId = dependency.getPluginId();
        PluginEnabledState state = enabledMap.get(dependencyId);

        if (!dependencyId.equals(descriptor.getPluginId()) &&
            !(state != null && state.isEnabled())) {
          result.add(dependency);
        }
        return FileVisitResult.CONTINUE;
      });
    }

    return Collections.unmodifiableList(result);
  }
private static @NotNull List<IdeaPluginDescriptorImpl> getDependenciesToEnable(@NotNull Collection<IdeaPluginDescriptorImpl> descriptors,
                                                                                 @NotNull Map<PluginId, PluginEnabledState> enabledMap,
                                                                                 @NotNull Map<PluginId, IdeaPluginDescriptorImpl> pluginIdMap)