From 3fdecb6705572efd61edf02e725000350d067c4a Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 7 Jun 2011 16:57:03 +0200 Subject: [PATCH] groupIds for commit and exception notifications --- .../src/com/intellij/diagnostic/MessagePool.java | 8 ++++---- .../com/intellij/openapi/vcs/changes/ui/CommitHelper.java | 5 ++--- .../openapi/vcs/update/AbstractCommonUpdateAction.java | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java b/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java index 0451b6b5c8d3..687974b70180 100644 --- a/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java +++ b/platform/platform-impl/src/com/intellij/diagnostic/MessagePool.java @@ -16,9 +16,7 @@ package com.intellij.diagnostic; import com.intellij.concurrency.JobScheduler; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; +import com.intellij.notification.*; import com.intellij.openapi.diagnostic.IdeaLoggingEvent; import org.apache.log4j.Category; import org.apache.log4j.Priority; @@ -31,6 +29,8 @@ import java.util.Set; import java.util.concurrent.TimeUnit; public class MessagePool { + private static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("IDE Fatal Errors", NotificationDisplayType.NONE, true); + private static final int MAX_POOL_SIZE_FOR_FATALS = 100; @@ -58,7 +58,7 @@ public class MessagePool { LogMessage message = new LogMessage(aEvent); if (myIdeFatals.size() < MAX_POOL_SIZE_FOR_FATALS) { myFatalsGrouper.add(message); - Notifications.Bus.notify(new Notification(Notifications.LOG_ONLY_GROUP_ID, "Exception", message.getMessage(), NotificationType.ERROR)); + NOTIFICATION_GROUP.createNotification("Exception", message.getMessage(), NotificationType.ERROR, null).notify(null); } else if (myIdeFatals.size() == MAX_POOL_SIZE_FOR_FATALS) { myFatalsGrouper.add(new LogMessage(new LoggingEvent(DiagnosticBundle.message("error.monitor.too.many.errors"), Category.getRoot(), Priority.ERROR, null, new TooManyErrorsException()))); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java index 859b13a7b3c2..01b1a940e397 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitHelper.java @@ -18,9 +18,7 @@ package com.intellij.openapi.vcs.changes.ui; import com.intellij.history.LocalHistory; import com.intellij.history.LocalHistoryAction; -import com.intellij.notification.Notification; import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; @@ -37,6 +35,7 @@ import com.intellij.openapi.vcs.changes.actions.MoveChangesToAnotherListAction; import com.intellij.openapi.vcs.changes.committed.CommittedChangesCache; import com.intellij.openapi.vcs.checkin.CheckinEnvironment; import com.intellij.openapi.vcs.checkin.CheckinHandler; +import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction; import com.intellij.openapi.vcs.update.RefreshVFsSynchronously; import com.intellij.util.Consumer; import com.intellij.util.NullableFunction; @@ -130,7 +129,7 @@ public class CommitHelper { text += ", " + changesFailedToCommit.size() + " Change(s) Failed To Commit"; } final String title = "VCS Commit Finished"; - Notifications.Bus.notify(new Notification(Notifications.LOG_ONLY_GROUP_ID, title + ", " + text, myCommitMessage, NotificationType.INFORMATION), myProject); + AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(title + ", " + text, myCommitMessage, NotificationType.INFORMATION, null).notify( myProject); return new NotificationInfo("VCS Commit", title, text, true); } }; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java index fab2abc2af6b..f15e9364768c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/AbstractCommonUpdateAction.java @@ -62,7 +62,7 @@ import java.io.File; import java.util.*; public abstract class AbstractCommonUpdateAction extends AbstractVcsAction { - private static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("VCS Update", NotificationDisplayType.NONE, true); + public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("VCS Update/Commit", NotificationDisplayType.NONE, true); private final boolean myAlwaysVisible; private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.update.AbstractCommonUpdateAction");