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
;
17 public class ProjectNotificationsComponent
extends AbstractProjectComponent
{
18 public ProjectNotificationsComponent(final Project project
) {
22 public void projectOpened() {
23 if (isDummyEnvironment()) {
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
);
36 private static boolean isDummyEnvironment() {
37 final Application application
= ApplicationManager
.getApplication();
38 return application
.isUnitTestMode() || application
.isCommandLine();
42 public String
getComponentName() {
43 return "Project Notifications";