diff --git a/base/src/com/google/idea/blaze/base/dependencies/AddSourceToProjectHelper.java b/base/src/com/google/idea/blaze/base/dependencies/AddSourceToProjectHelper.java index 30f7ae699f6..2e2780aaaa5 100644 --- a/base/src/com/google/idea/blaze/base/dependencies/AddSourceToProjectHelper.java +++ b/base/src/com/google/idea/blaze/base/dependencies/AddSourceToProjectHelper.java @@ -50,10 +50,9 @@ import com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverProvider; import com.google.idea.blaze.base.targetmaps.SourceToTargetMap; import com.intellij.notification.Notification; -import com.intellij.notification.NotificationDisplayType; -import com.intellij.notification.NotificationGroup; import com.intellij.notification.NotificationListener; import com.intellij.notification.NotificationType; +import com.intellij.notification.Notifications; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; @@ -71,10 +70,6 @@ class AddSourceToProjectHelper { - private static final NotificationGroup NOTIFICATION_GROUP = - new NotificationGroup( - "Add source to project", NotificationDisplayType.BALLOON, /* logByDefault= */ true); - static boolean autoDeriveTargets(Project project) { return ProjectViewManager.getInstance(project) .getProjectViewSet() @@ -189,13 +184,13 @@ private static void addTargets( } private static void notifyFailed(Project project, String message) { - Notification notification = - NOTIFICATION_GROUP.createNotification( + Notifications.Bus.notify( + new Notification( + "AddToProject", "Failed to add source file to project", message, - NotificationType.WARNING, - /* listener= */ null); - notification.notify(project); + NotificationType.WARNING), + project); } private static void notifySuccess( @@ -214,19 +209,22 @@ private static void notifySuccess( targets.forEach(t -> builder.append(" ").append(t).append("\n")); } builder.append("Open project view file"); - Notification notification = - NOTIFICATION_GROUP.createNotification( - "Updated project view file", - builder.toString(), - NotificationType.INFORMATION, - new NotificationListener.Adapter() { - @Override - protected void hyperlinkActivated(Notification notification, HyperlinkEvent e) { - notification.expire(); - OpenProjectViewAction.openLocalProjectViewFile(project); - } - }); - notification.notify(project); + + Notifications.Bus.notify( + new Notification( + "AddToProject", + "Updated project view file", + builder.toString(), + NotificationType.INFORMATION) + .setListener( + new NotificationListener.Adapter() { + @Override + protected void hyperlinkActivated(Notification notification, HyperlinkEvent e) { + notification.expire(); + OpenProjectViewAction.openLocalProjectViewFile(project); + } + }), + project); } /**