[java] IDEA-352622 JarRepositoryManager requests service from class init

GitOrigin-RevId: 858f0dce9a5c7c277b35d22afee0ce5ef748d233
This commit is contained in:
Yuriy Artamonov
2024-04-28 12:15:10 +02:00
committed by intellij-monorepo-bot
parent 8fc4c0d4e0
commit 13fedab45a
5 changed files with 8 additions and 7 deletions
@@ -93,7 +93,9 @@ public final class JarRepositoryManager {
// used in integration tests
private static final boolean DO_REFRESH = SystemProperties.getBooleanProperty("idea.do.refresh.after.jps.library.downloaded", true);
public final static NotificationGroup GROUP = NotificationGroupManager.getInstance().getNotificationGroup("Repository");
public static @NotNull NotificationGroup getNotificationGroup() {
return NotificationGroupManager.getInstance().getNotificationGroup("Repository");
}
public static boolean hasRunningTasks() {
return ourTasksInProgress.get() > 0; // todo: count tasks on per-project basis?
@@ -383,7 +385,7 @@ public final class JarRepositoryManager {
sb.append(root.getFile().getName());
}
@NlsSafe final String content = sb.toString();
Notifications.Bus.notify(GROUP.createNotification(title, content, NotificationType.INFORMATION), project);
Notifications.Bus.notify(getNotificationGroup().createNotification(title, content, NotificationType.INFORMATION), project);
}
public static void searchArtifacts(Project project,
@@ -141,7 +141,7 @@ internal fun removeDuplicatedUrlsFromRepositoryLibraries(project: Project) {
else {
"${validLibraries.size} libraries"
}
Notifications.Bus.notify(JarRepositoryManager.GROUP.createNotification(
Notifications.Bus.notify(JarRepositoryManager.getNotificationGroup().createNotification(
JavaUiBundle.message("notification.title.repository.libraries.cleanup"),
JavaUiBundle.message("notification.text.duplicated.urls.were.removed",
libraryText,
@@ -283,7 +283,7 @@ class RepositoryLibraryUtils(private val project: Project, private val cs: Corou
if (isInfoNotificationDisabled && type == NotificationType.INFORMATION) return
/* Reuse [JarRepositoryManager]'s notification group */
val notification = JarRepositoryManager.GROUP.createNotification(
val notification = JarRepositoryManager.getNotificationGroup().createNotification(
JavaUiBundle.message("repository.library.utils.library.update.title"),
content,
type
@@ -21,10 +21,9 @@ internal fun reloadAllRepositoryLibraries(project: Project) {
.toList()
.collectResults()
.onSuccess {
Notifications.Bus.notify(JarRepositoryManager.GROUP.createNotification(
Notifications.Bus.notify(JarRepositoryManager.getNotificationGroup().createNotification(
JavaUiBundle.message("notification.title.repository.library.synchronization"),
JavaUiBundle.message("notification.content.libraries.reloaded", it.size),
NotificationType.INFORMATION), project)
}
}
@@ -21,7 +21,7 @@ class RepositoryLibraryResolveErrorNotification extends Notification {
RepositoryLibraryResolveErrorNotification() {
super(
JarRepositoryManager.GROUP.getDisplayId(),
JarRepositoryManager.getNotificationGroup().getDisplayId(),
JavaUiBundle.message("notification.title.repository.library.synchronization"),
"",
NotificationType.ERROR