don't depend on NotificationModel

This commit is contained in:
peter
2011-06-15 15:43:42 +02:00
parent 0fecd63098
commit dfa8484142
3 changed files with 10 additions and 21 deletions
@@ -85,6 +85,13 @@ public class EventLog implements Notifications {
}
}
public static void expire(@NotNull Notification notification) {
getApplicationComponent().myModel.removeNotification(notification);
for (Project p : ProjectManager.getInstance().getOpenProjects()) {
getProjectComponent(p).myProjectModel.removeNotification(notification);
}
}
private static EventLog getApplicationComponent() {
return ApplicationManager.getApplication().getComponent(EventLog.class);
}
@@ -15,15 +15,12 @@
*/
package com.intellij.notification;
import com.intellij.notification.impl.NotificationModelListener;
import com.intellij.notification.impl.NotificationsConfiguration;
import com.intellij.notification.impl.NotificationsManagerImpl;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
@@ -40,23 +37,6 @@ public class LogModel {
LogModel(@Nullable Project project) {
myProject = project;
NotificationsManagerImpl.getNotificationsManagerImpl().addListener(new NotificationModelListener() {
@Override
public void notificationsAdded(@NotNull Notification... notification) {
}
@Override
public void notificationsRemoved(@NotNull Notification... notification) {
for (Notification notification1 : notification) {
removeNotification(notification1);
}
}
@Override
public void notificationsRead(@NotNull Notification... notification) {
}
}, project == null ? ApplicationManager.getApplication() : project);
}
void addNotification(Notification notification) {
@@ -103,7 +83,8 @@ public class LogModel {
}
}
private void removeNotification(Notification notification) {
void removeNotification(Notification notification) {
NotificationsManagerImpl.getNotificationsManagerImpl().remove(notification);
synchronized (myNotifications) {
myNotifications.remove(notification);
}
@@ -70,6 +70,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
@Override
public void expire(@NotNull Notification notification) {
EventLog.expire(notification);
remove(notification);
}