close all tooltips for the project when it closes, avoid tooltips leaks

This commit is contained in:
Alexey Kudravtsev
2017-01-24 13:51:33 +03:00
parent 679000ba54
commit d87dbd12d7
@@ -15,6 +15,7 @@
*/
package com.intellij.notification.impl;
import com.intellij.codeInsight.hint.TooltipController;
import com.intellij.icons.AllIcons;
import com.intellij.ide.FrameStateManager;
import com.intellij.ide.ui.laf.darcula.ui.DarculaButtonPainter;
@@ -30,6 +31,7 @@ import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.project.DumbAwareRunnable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.DialogWrapperDialog;
import com.intellij.openapi.ui.MessageType;
@@ -88,6 +90,15 @@ public class NotificationsManagerImpl extends NotificationsManager {
public NotificationsManagerImpl() {
ApplicationManager.getApplication().getMessageBus().connect().subscribe(Notifications.TOPIC, new MyNotificationListener(null));
ApplicationManager.getApplication().getMessageBus().connect().subscribe(ProjectManager.TOPIC, new ProjectManagerAdapter() {
@Override
public void projectClosed(Project project) {
for (Notification notification : getNotificationsOfType(Notification.class, project)) {
notification.hideBalloon();
}
TooltipController.getInstance().resetCurrent();
}
});
}
@Override