diff --git a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java index 8d18828a4d5b..257fb38063dc 100644 --- a/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java +++ b/java/compiler/impl/src/com/intellij/compiler/impl/CompileDriver.java @@ -552,13 +552,10 @@ public class CompileDriver { final MessageType messageType = errorCount > 0 ? MessageType.ERROR : warningCount > 0 ? MessageType.WARNING : MessageType.INFO; if (duration > ONE_MINUTE_MS) { ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, messageType, statusMessage); - } else { - String logMessage = statusMessage; - if (_status == ExitStatus.UP_TO_DATE) { - logMessage = "Compilation: all files are up to date"; - } - NOTIFICATION_GROUP.createNotification(logMessage, messageType.toNotificationType()).notify(myProject); } + + NOTIFICATION_GROUP.createNotification(_status == ExitStatus.UP_TO_DATE ? "Compilation: all files are up to date" : statusMessage, messageType).notify(myProject); + if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) { compileContext.addMessage(CompilerMessageCategory.INFORMATION, statusMessage, null, -1, -1); } diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapProgressImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapProgressImpl.java index a53eccb459cf..52820dd464b3 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapProgressImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapProgressImpl.java @@ -20,6 +20,9 @@ import com.intellij.debugger.DebuggerInvocationUtil; import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.impl.HotSwapProgress; import com.intellij.debugger.settings.DebuggerSettings; +import com.intellij.notification.NotificationDisplayType; +import com.intellij.notification.NotificationGroup; +import com.intellij.notification.NotificationType; import com.intellij.openapi.progress.PerformInBackgroundOption; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.impl.BackgroundableProcessIndicator; @@ -29,7 +32,6 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.openapi.wm.WindowManager; import com.intellij.util.StringBuilderSpinAllocator; import com.intellij.util.ui.MessageCategory; import gnu.trove.TIntObjectHashMap; @@ -41,6 +43,8 @@ import java.util.Iterator; import java.util.List; public class HotSwapProgressImpl extends HotSwapProgress{ + static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("HotSwap", NotificationDisplayType.NONE, true); + TIntObjectHashMap> myMessages = new TIntObjectHashMap>(); private final ProgressIndicator myProgressIndicator; private final ProgressWindow myProgressWindow; @@ -73,14 +77,16 @@ public class HotSwapProgressImpl extends HotSwapProgress{ final List errors = getMessages(MessageCategory.ERROR); final List warnings = getMessages(MessageCategory.WARNING); if (errors.size() > 0) { - ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.ERROR, buildMessage(errors), null, - null); - WindowManager.getInstance().getStatusBar(getProject()).setInfo(DebuggerBundle.message("status.hot.swap.completed.with.errors")); + final String message = buildMessage(errors); + ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.ERROR, message, null, null); + NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.errors"), message, + NotificationType.ERROR, null).notify(getProject()); } else if (warnings.size() > 0){ - ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.WARNING, buildMessage(warnings), - Messages.getWarningIcon(), null); - WindowManager.getInstance().getStatusBar(getProject()).setInfo(DebuggerBundle.message("status.hot.swap.completed.with.warnings")); + final String message = buildMessage(warnings); + ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.WARNING, message, Messages.getWarningIcon(), null); + NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.hot.swap.completed.with.warnings"), + message, NotificationType.WARNING, null).notify(getProject()); } else if (myMessages.size() > 0){ final StringBuilder msg = StringBuilderSpinAllocator.alloc(); @@ -99,7 +105,7 @@ public class HotSwapProgressImpl extends HotSwapProgress{ } final String message = msg.toString(); ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.INFO, message, null, null); - WindowManager.getInstance().getStatusBar(getProject()).setInfo(message); + NOTIFICATION_GROUP.createNotification(message, NotificationType.INFORMATION).notify(getProject()); } finally { StringBuilderSpinAllocator.dispose(msg); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java index d88f70349d65..ec3749d77851 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/HotSwapUIImpl.java @@ -21,6 +21,7 @@ import com.intellij.debugger.impl.DebuggerSession; import com.intellij.debugger.impl.HotSwapFile; import com.intellij.debugger.impl.HotSwapManager; import com.intellij.debugger.settings.DebuggerSettings; +import com.intellij.notification.NotificationType; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; @@ -35,7 +36,6 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Ref; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager; -import com.intellij.openapi.wm.WindowManager; import com.intellij.psi.PsiDocumentManager; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; @@ -138,7 +138,7 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent{ public void run() { final String message = DebuggerBundle.message("status.hotswap.uptodate"); ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.DEBUG, MessageType.INFO, message, null, null); - WindowManager.getInstance().getStatusBar(myProject).setInfo(message); + HotSwapProgressImpl.NOTIFICATION_GROUP.createNotification(message, NotificationType.INFORMATION).notify(myProject); } }, ModalityState.NON_MODAL); return; diff --git a/platform/platform-api/src/com/intellij/notification/Notifications.java b/platform/platform-api/src/com/intellij/notification/Notifications.java index a1e3d2d60221..190de2a3e38f 100644 --- a/platform/platform-api/src/com/intellij/notification/Notifications.java +++ b/platform/platform-api/src/com/intellij/notification/Notifications.java @@ -36,7 +36,6 @@ public interface Notifications { Topic TOPIC = Topic.create("Notifications", Notifications.class, Topic.BroadcastDirection.NONE); String SYSTEM_MESSAGES_GROUP_ID = "System Messages"; - String LOG_ONLY_GROUP_ID = "Log Only"; void notify(@NotNull Notification notification); void register(@NotNull final String groupDisplayType, @NotNull final NotificationDisplayType defaultDisplayType); @@ -44,10 +43,6 @@ public interface Notifications { @SuppressWarnings({"UtilityClassWithoutPrivateConstructor"}) class Bus { - static { - register(LOG_ONLY_GROUP_ID, NotificationDisplayType.NONE); - } - /** * Registration is OPTIONAL: STICKY_BALLOON display type will be used by default. */ diff --git a/platform/platform-impl/src/com/intellij/notification/NotificationGroup.java b/platform/platform-impl/src/com/intellij/notification/NotificationGroup.java index 7e783257fdf0..b47106b8e076 100644 --- a/platform/platform-impl/src/com/intellij/notification/NotificationGroup.java +++ b/platform/platform-impl/src/com/intellij/notification/NotificationGroup.java @@ -17,6 +17,7 @@ package com.intellij.notification; import com.intellij.notification.impl.NotificationSettings; import com.intellij.notification.impl.NotificationsConfiguration; +import com.intellij.openapi.ui.MessageType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -32,6 +33,14 @@ public class NotificationGroup { NotificationsConfiguration.getNotificationsConfiguration().registerDefaultSettings(new NotificationSettings(displayId, defaultDisplayType, logByDefault)); } + public String getDisplayId() { + return myDisplayId; + } + + public Notification createNotification(@NotNull final String content, @NotNull final MessageType type) { + return createNotification(content, type.toNotificationType()); + } + public Notification createNotification(@NotNull final String content, @NotNull final NotificationType type) { return createNotification("", content, type, null); } diff --git a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfiguration.java b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfiguration.java index 72dd7a92fbc8..254959a6bab3 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfiguration.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/NotificationsConfiguration.java @@ -79,12 +79,7 @@ public class NotificationsConfiguration implements ApplicationComponent, Notific } private synchronized NotificationSettings[] _getAllSettings() { - final List result = new ArrayList(); - for (String s : myIdToSettingsMap.keySet()) { - if (!Notifications.LOG_ONLY_GROUP_ID.equals(s)) { - result.add(myIdToSettingsMap.get(s)); - } - } + final List result = new ArrayList(myIdToSettingsMap.values()); Collections.sort(result, new Comparator() { public int compare(NotificationSettings o1, NotificationSettings o2) { @@ -154,5 +149,6 @@ public class NotificationsConfiguration implements ApplicationComponent, Notific myIdToSettingsMap.put(id, settings); } } + _remove("Log Only"); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java index e2b365abee25..53fdc03106fd 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowManagerImpl.java @@ -20,9 +20,6 @@ import com.intellij.facet.ProjectFacetManager; import com.intellij.facet.ProjectWideFacetListenersRegistry; import com.intellij.ide.ui.LafManager; import com.intellij.ide.ui.LafManagerListener; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationListener; -import com.intellij.notification.Notifications; import com.intellij.notification.impl.NotificationsManagerImpl; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; @@ -72,7 +69,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.event.EventListenerList; -import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; import java.awt.*; import java.awt.event.KeyEvent; @@ -1280,7 +1276,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements if (existing != null) { existing.hide(); } - Notifications.Bus.notify(createNotification(type, text, listener), myProject); if (NotificationsManagerImpl.isEventLogVisible(myProject)) { return; @@ -1389,16 +1384,6 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements } - public static Notification createNotification(MessageType type, String text, @Nullable final HyperlinkListener listener) { - final NotificationListener notificationListener = listener == null ? null : new NotificationListener() { - @Override - public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { - listener.hyperlinkUpdate(event); - } - }; - return new Notification(Notifications.LOG_ONLY_GROUP_ID, "", text, type.toNotificationType(), notificationListener); - } - @Override public Balloon getToolWindowBalloon(String id) { return myWindow2Balloon.get(id); diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java index fedf2d1227dc..fcbf45c9bfdc 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/ui/SMTRunnerNotificationsHandler.java @@ -16,6 +16,7 @@ package com.intellij.execution.testframework.sm.runner.ui; import com.intellij.execution.testframework.TestConsoleProperties; +import com.intellij.execution.testframework.TestsUIUtil; import com.intellij.execution.testframework.sm.SMTestsRunnerBundle; import com.intellij.execution.testframework.sm.runner.SMTRunnerEventsAdapter; import com.intellij.execution.testframework.sm.runner.SMTestProxy; @@ -137,6 +138,7 @@ public class SMTRunnerNotificationsHandler extends SMTRunnerEventsAdapter { if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { toolWindowManager.notifyByBalloon(testRunDebugId, type, msg, null, null); } + TestsUIUtil.NOTIFICATION_GROUP.createNotification(msg, type).notify(project); } }); } diff --git a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java index c95d058e4b4e..fc0b9746f166 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/TestsUIUtil.java @@ -45,7 +45,7 @@ import java.awt.image.BufferedImage; import java.util.List; public class TestsUIUtil { - private static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("Test Runner", NotificationDisplayType.NONE, true); + public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("Test Runner", NotificationDisplayType.NONE, true); @NonNls private static final String ICONS_ROOT = "/runConfigurations/"; public static final Color PASSED_COLOR = new Color(0, 128, 0); @@ -125,9 +125,9 @@ public class TestsUIUtil { if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { toolWindowManager.notifyByBalloon(testRunDebugId, type, balloonText, null, null); - } else { - NOTIFICATION_GROUP.createNotification(balloonText, type.toNotificationType()).notify(project); } + + NOTIFICATION_GROUP.createNotification(balloonText, type).notify(project); SystemNotifications.getInstance().notify("TestRunner", title, text); } diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java index f8de79f45951..589cd6c0d770 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PatchApplier.java @@ -39,6 +39,7 @@ import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vcs.changes.patch.ApplyPatchAction; import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager; +import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction; import com.intellij.openapi.vfs.ReadonlyStatusHandler; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; @@ -384,8 +385,9 @@ public class PatchApplier { else if (status == ApplyPatchStatus.PARTIAL) { showError(project, VcsBundle.message("patch.apply.partially.applied"), false); } else if (ApplyPatchStatus.SUCCESS.equals(status)) { - ToolWindowManager.getInstance(project).notifyByBalloon(ChangesViewContentManager.TOOLWINDOW_ID, MessageType.INFO, - VcsBundle.message("patch.apply.success.applied.text")); + final String message = VcsBundle.message("patch.apply.success.applied.text"); + ToolWindowManager.getInstance(project).notifyByBalloon(ChangesViewContentManager.TOOLWINDOW_ID, MessageType.INFO, message); + AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(project); } } @@ -393,10 +395,6 @@ public class PatchApplier { return myRemainingPatches; } - public boolean hasRemainingPatches() { - return ! myRemainingPatches.isEmpty(); - } - private boolean makeWritable(final List filesToMakeWritable) { final VirtualFile[] fileArray = VfsUtil.toVirtualFileArray(filesToMakeWritable); final ReadonlyStatusHandler.OperationStatus readonlyStatus = ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(fileArray); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java index 971b234a8e73..6e6bd05d1225 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ui/VcsBalloonProblemNotifier.java @@ -23,6 +23,7 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager; +import com.intellij.openapi.vcs.update.AbstractCommonUpdateAction; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.openapi.wm.WindowManager; @@ -98,6 +99,8 @@ public class VcsBalloonProblemNotifier implements Runnable { } private void doForProject(@NotNull final Project project) { + AbstractCommonUpdateAction.NOTIFICATION_GROUP.createNotification(myMessage, myMessageType).notify(project); + final ToolWindowManager manager = ToolWindowManager.getInstance(project); final String toolWindowId = (myShowOverChangesView ? ChangesViewContentManager.TOOLWINDOW_ID : ToolWindowId.VCS); final boolean haveWindow = (! project.isDefault()) && (manager.getToolWindow(toolWindowId) != null); 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 f15e9364768c..ad4a06df2963 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 { - public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("VCS Update/Commit", NotificationDisplayType.NONE, true); + public static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("Common Version Control Messages", NotificationDisplayType.NONE, true); private final boolean myAlwaysVisible; private final static Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.update.AbstractCommonUpdateAction"); diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java index b89db6c03913..2a524389c3d3 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGRunnableState.java @@ -54,13 +54,11 @@ import com.intellij.openapi.util.Getter; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.JavaPsiFacade; import com.intellij.psi.PsiClass; -import com.intellij.psi.PsiFile; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.util.PathUtil; import com.intellij.util.net.NetUtils; @@ -70,7 +68,6 @@ import com.theoryinpractice.testng.ui.TestNGResults; import com.theoryinpractice.testng.ui.actions.RerunFailedTestsAction; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.testng.CommandLineArgs; import org.testng.IDEATestNGListener; import org.testng.RemoteTestNGStarter; @@ -159,13 +156,14 @@ public class TestNGRunnableState extends JavaCommandLineState { final TestNGResults resultsView = console.getResultsView(); final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { - toolWindowManager.notifyByBalloon(testRunDebugId, - resultsView == null || resultsView.getStatus() == MessageHelper.SKIPPED_TEST - ? MessageType.WARNING - : (resultsView.getStatus() == MessageHelper.FAILED_TEST - ? MessageType.ERROR - : MessageType.INFO), - resultsView == null ? "Tests were not started" : resultsView.getStatusLine(), null, null); + final MessageType type = resultsView == null || resultsView.getStatus() == MessageHelper.SKIPPED_TEST + ? MessageType.WARNING + : (resultsView.getStatus() == MessageHelper.FAILED_TEST + ? MessageType.ERROR + : MessageType.INFO); + final String message = resultsView == null ? "Tests were not started" : resultsView.getStatusLine(); + toolWindowManager.notifyByBalloon(testRunDebugId, type, message, null, null); + TestsUIUtil.NOTIFICATION_GROUP.createNotification(message, type).notify(project); } } });