public static @NotNull Collection<PluginNode> installPlugins(@NotNull Set<PluginId> pluginIds) {
    logInfo("looking up plugins: " + pluginIds);
    var plugins = RepositoryHelper.loadPlugins(pluginIds);

    if (!PluginManagerMain.checkThirdPartyPluginsAllowed(plugins)) {
      logInfo("3rd-party plugins rejected");
      return Collections.emptyList();
    }

    if (plugins.size() < pluginIds.size()) {
      var unknown = new HashSet<>(pluginIds);
      for (var plugin : plugins) unknown.remove(plugin.getPluginId());
      logInfo("unknown plugins: " + unknown);
    }

    @SuppressWarnings("UsagesOfObsoleteApi") var indicator = new EmptyProgressIndicator();
    var policy = PluginManagementPolicy.getInstance();
    var installed = new ArrayList<PluginNode>();

    for (var plugin : plugins) {
      if (PluginManagerCore.getPlugin(plugin.getPluginId()) != null) {
        logInfo("already installed: " + plugin.getPluginId());
        installed.add(plugin);
        continue;
      }
      if (!policy.canInstallPlugin(plugin)) {
        logInfo("rejected by policy: " + plugin.getPluginId());
        continue;
      }
      try {
        var downloader = PluginDownloader.createDownloader(plugin, plugin.getRepositoryName(), null);
        if (downloader.prepareToInstall(indicator)) {
          PluginInstaller.unpackPlugin(downloader.getFilePath(), PathManager.getPluginsDir());
          installed.add(plugin);
          logInfo("installed plugin: " + plugin);
        }
      }
      catch (Exception e) {
        LOG.error("cannot install: " + plugin.getPluginId(), e);
      }
    }

    PluginEnabler.HEADLESS.enable(installed);

    return new ArrayList<>(installed);
  }
public static @NotNull Collection<PluginNode> installPlugins(@NotNull Set<PluginId> pluginIds)