leaked CmdMerger in UndoManager in tests
[fedora-idea.git] / platform / platform-impl / src / com / intellij / notification / impl / ProjectNotificationsComponent.java
blob0f9fd16704a4d65e2c9a417e3ab670b1d810a995
1 package com.intellij.notification.impl;
3 import com.intellij.notification.Notifications;
4 import com.intellij.openapi.Disposable;
5 import com.intellij.openapi.application.Application;
6 import com.intellij.openapi.application.ApplicationManager;
7 import com.intellij.openapi.components.AbstractProjectComponent;
8 import com.intellij.openapi.project.Project;
9 import com.intellij.openapi.util.Disposer;
10 import com.intellij.openapi.wm.WindowManager;
11 import com.intellij.openapi.wm.ex.StatusBarEx;
12 import org.jetbrains.annotations.NotNull;
14 /**
15 * @author spleaner
17 public class ProjectNotificationsComponent extends AbstractProjectComponent {
18 public ProjectNotificationsComponent(final Project project) {
19 super(project);
22 public void projectOpened() {
23 if (isDummyEnvironment()) {
24 return;
27 StatusBarEx statusBar = (StatusBarEx)WindowManager.getInstance().getStatusBar(myProject);
28 myProject.getMessageBus().connect().subscribe(Notifications.TOPIC, statusBar.getNotificationArea());
29 Disposer.register(myProject, new Disposable() {
30 public void dispose() {
31 NotificationsManager.getNotificationsManager().clear(myProject);
33 });
36 private static boolean isDummyEnvironment() {
37 final Application application = ApplicationManager.getApplication();
38 return application.isUnitTestMode() || application.isCommandLine();
41 @NotNull
42 public String getComponentName() {
43 return "Project Notifications";