Collection<PluginNode> (@NotNull Set<PluginId> pluginIds) { var plugins = RepositoryHelper.loadPlugins(pluginIds); if (!PluginManagerMain.checkThirdPartyPluginsAllowed(plugins)) { LOG.info("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()); LOG.info("unknown plugins: " + unknown); } var indicator = new EmptyProgressIndicator(); var policy = PluginManagementPolicy.getInstance(); var installed = new ArrayList<PluginNode>(); for (var plugin : plugins) { if (PluginManagerCore.getPlugin(plugin.getPluginId()) != null) { LOG.info("already installed: " + plugin.getPluginId()); continue; } if (!policy.canInstallPlugin(plugin)) { LOG.info("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); } } catch (Exception e) { LOG.error("cannot install: " + plugin.getPluginId(), e); } } PluginEnabler.HEADLESS.enable(installed); return new ArrayList<>(installed); }