void (@NotNull Project project, @NotNull ExternalDependenciesManager dependencyManager) { List<DependencyOnPlugin> dependencies = dependencyManager.getDependencies(DependencyOnPlugin.class); if (dependencies.isEmpty()) { return; } String projectName = project.getName(); final List<@Nls String> errorMessages = new ArrayList<>(); final List<IdeaPluginDescriptor> disabled = new ArrayList<>(); final Set<PluginId> notInstalled = new HashSet<>(); List<IdeaPluginDescriptor> pluginsToEnableWithoutRestart = new ArrayList<>(); ApplicationInfo applicationInfo = ApplicationInfo.getInstance(); PluginEnabler pluginEnabler = PluginEnabler.getInstance(); for (DependencyOnPlugin dependency : dependencies) { PluginId pluginId = PluginId.getId(dependency.getPluginId()); IdeaPluginDescriptorImpl descriptor = PluginManagerCore.findPlugin(pluginId); if (descriptor == null) { errorMessages.add(IdeBundle.message("error.plugin.required.for.project.not.installed", pluginId, projectName)); notInstalled.add(pluginId); continue; } String pluginName = descriptor.getName(); if (pluginEnabler.isDisabled(pluginId)) { boolean canEnableWithoutRestart = Registry.is("ide.plugins.load.automatically") && DynamicPlugins.allowLoadUnloadWithoutRestart(descriptor); if (canEnableWithoutRestart) { pluginsToEnableWithoutRestart.add(descriptor); } else { errorMessages.add(IdeBundle.message("error.plugin.required.for.project.disabled", pluginName, projectName)); disabled.add(descriptor); } continue; } String minVersion = dependency.getMinVersion(); String maxVersion = dependency.getMaxVersion(); String pluginVersion = descriptor.getVersion(); BuildNumber currentIdeVersion = applicationInfo.getBuild(); if (descriptor.isBundled() && !descriptor.allowBundledUpdate() && currentIdeVersion.asStringWithoutProductCode().equals(pluginVersion)) { String pluginFromString = PluginManagerCore.CORE_ID.equals(descriptor.getPluginId()) ? "" : "plugin '" + pluginName + "' from "; if (minVersion != null && currentIdeVersion.compareTo(BuildNumber.fromString(minVersion)) < 0) { errorMessages.add(IdeBundle.message("error.project.requires.newer.ide", projectName, pluginFromString, minVersion, pluginVersion)); } if (maxVersion != null && currentIdeVersion.compareTo(BuildNumber.fromString(maxVersion)) > 0) { errorMessages.add(IdeBundle.message("error.project.requires.older.ide", projectName, pluginFromString, maxVersion, pluginVersion)); } } else { if (minVersion != null && VersionComparatorUtil.compare(pluginVersion, minVersion) < 0) { errorMessages.add(IdeBundle.message("error.project.requires.newer.plugin", projectName, pluginName, minVersion, pluginVersion)); } if (maxVersion != null && VersionComparatorUtil.compare(pluginVersion, maxVersion) > 0) { errorMessages.add(IdeBundle.message("error.project.requires.older.plugin", projectName, pluginName, maxVersion, pluginVersion)); } } } if (!pluginsToEnableWithoutRestart.isEmpty()) { ApplicationManager.getApplication().invokeLater(() -> { enablePlugins(pluginsToEnableWithoutRestart, pluginEnabler); }); } if (errorMessages.isEmpty()) { return; } Notification notification = NotificationGroupManager.getInstance().getNotificationGroup(NOTIFICATION_GROUP_ID) .createNotification(IdeBundle.message("notification.title.required.plugins.not.loaded"), StringUtil.join(errorMessages, "<br>"), NotificationType.ERROR); if (!disabled.isEmpty()) { notification.addAction(new NotificationAction(disabled.size() == 1 ? IdeBundle.message("link.enable.required.plugin", disabled.get(0).getName()) : IdeBundle.message("link.enable.required.plugins")) { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { notification.expire(); if (!enablePlugins(disabled, pluginEnabler)) { PluginManagerMain.notifyPluginsUpdated(project); } } }); } else if (!notInstalled.isEmpty()) { notification.addAction(new NotificationAction(IdeBundle.message("link.install.required.plugins")) { @Override public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) { HashSet<PluginId> pluginIds = new HashSet<>(notInstalled); pluginIds.addAll(notInstalled); for (IdeaPluginDescriptor descriptor : disabled) { pluginIds.add(descriptor.getPluginId()); } PluginsAdvertiser.installAndEnable(project, pluginIds, true, true, () -> notification.expire()); } }); } notification.setSuggestionType(!notification.getActions().isEmpty()).notify(project); }