package com.intellij.notification.impl;

import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.ex.StatusBarEx;
import com.intellij.openapi.application.ApplicationManager;
import org.jetbrains.annotations.NotNull;

/**
 * @author spleaner
 */
public class ProjectNotificationsComponent implements ProjectComponent {
  private Project myProject;
  private StatusBarEx myStatusBar;

  public ProjectNotificationsComponent(final Project project) {
    myProject = project;
  }

  public void projectOpened() {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      return;
    }

    myStatusBar = (StatusBarEx) WindowManager.getInstance().getStatusBar(myProject);
    myStatusBar.getNotificationArea().connect(myProject);
  }

  public void projectClosed() {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
      return;
    }

    myStatusBar.getNotificationArea().getModel().clearProjectNotifications();
    myProject = null;
  }

  @NotNull
  public String getComponentName() {
    return "Project Notifications";
  }

  public void initComponent() {
  }

  public void disposeComponent() {
  }
}

@@ -285,24 +285,77 @@
 ionManager;%0A
+import com.intellij.openapi.application.Application;%0A
 import org.j
@@ -384,16 +384,16 @@
 otNull;%0A
-
 %0A/**%0A * 
@@ -689,58 +689,26 @@
 if (
-ApplicationManager.getApplication().isUnitTestMode
+isDummyEnvironment
 ()) 
@@ -922,58 +922,26 @@
 if (
-ApplicationManager.getApplication().isUnitTestMode
+isDummyEnvironment
 ()) 
@@ -1041,16 +1041,16 @@
 ions();%0A
-
     myPr
@@ -1068,16 +1068,214 @@
 l;%0A  %7D%0A%0A
+  private static boolean isDummyEnvironment() %7B%0A    final Application application = ApplicationManager.getApplication();%0A    return application.isUnitTestMode() %7C%7C application.isCommandLine();%0A  %7D%0A%0A
   @NotNu

fix stress tests