void (@NotNull final List<ExecutionException> exceptions) { final Ref<Notification> notificationRef = new Ref<>(null); if (exceptions.isEmpty()) { notificationRef.set(new PackagingNotification(PACKAGING_GROUP_ID, getSuccessTitle(), getSuccessDescription(), NotificationType.INFORMATION, null)); } else { final List<Pair<String, String>> requirements = this instanceof InstallTask && ((InstallTask)this).myRequirements != null ? ContainerUtil.flatMap( ((InstallTask)this).myRequirements, req -> ContainerUtil.map(req.getInstallOptions(), option -> Pair.create(option, req.getName()))) : null; final List<String> packageManagerArguments = exceptions.stream() .flatMap(e -> (e instanceof PyExecutionException) ? ((PyExecutionException)e).getArgs().stream() : null) .toList(); final String packageNames = requirements != null ? requirements.stream() .filter(req -> packageManagerArguments.contains(req.first)) .map(req -> req.second) .collect(Collectors.joining(", ")) : ""; final PyPackageManagementService.PyPackageInstallationErrorDescription description = PyPackageManagementService. toErrorDescription(exceptions, mySdk, packageNames); if (description != null) { final String firstLine = PyBundle.message("python.packaging.notification.title.error.occurred", getTitle()); final NotificationListener listener = new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { assert myProject != null; final PyPackageInstallationErrorDialog dialog = new PyPackageInstallationErrorDialog(packageNames.isEmpty() ? IdeBundle.message("failed.to.install.packages.dialog.title") : IdeBundle.message("failed.to.install.package.dialog.title", packageNames), description); dialog.show(); } }; String content = wrapIntoLink(firstLine, "python.packaging.notification.description.details.link"); notificationRef.set(new PackagingNotification(PACKAGING_GROUP_ID, getFailureTitle(), content, NotificationType.ERROR, listener)); } } ApplicationManager.getApplication().invokeLater(() -> { if (myListener != null) { myListener.finished(exceptions); } final Notification notification = notificationRef.get(); if (notification != null) { notification.notify(myProject); } }); }