Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
irengrig
2010-05-31 17:41:52 +04:00
5 changed files with 24 additions and 14 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

@@ -38,7 +38,6 @@ import com.intellij.psi.PsiManager;
import com.intellij.ui.UIBundle;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.Consumer;
import com.intellij.util.ui.EmptyIcon;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,7 +48,7 @@ import java.awt.event.MouseEvent;
public class TogglePopupHintsPanel implements StatusBarWidget, StatusBarWidget.IconPresentation {
private static final Icon INSPECTIONS_ICON = IconLoader.getIcon("/ide/hectorOn.png");
private static final Icon INSPECTIONS_OFF_ICON = IconLoader.getIcon("/ide/hectorOff.png");
private static final Icon EMPTY_ICON = new EmptyIcon(INSPECTIONS_ICON.getIconWidth(), INSPECTIONS_ICON.getIconHeight());
private static final Icon EMPTY_ICON = IconLoader.getIcon("/ide/hectorNo.png");
private Icon myCurrentIcon;
private String myToolTipText;
@@ -98,6 +98,13 @@ public class Notification {
public void setBalloon(@Nullable final Balloon balloon) {
if (balloon != null) {
myBalloonRef = new WeakReference<Balloon>(balloon);
} else {
myBalloonRef = null;
}
}
@Nullable
public Balloon getBalloon() {
return myBalloonRef == null ? null : myBalloonRef.get();
}
}
@@ -17,15 +17,11 @@ package com.intellij.notification.impl;
import com.intellij.notification.*;
import com.intellij.notification.impl.ui.NotificationsUtil;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.ui.popup.BalloonBuilder;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.ui.popup.*;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.impl.IdeFrameImpl;
import com.intellij.ui.BalloonLayout;
@@ -193,6 +189,13 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
}
final Balloon balloon = builder.createBalloon();
balloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
notification.setBalloon(null);
}
});
notification.setBalloon(balloon);
final Runnable show = new Runnable() {
@@ -209,13 +212,6 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
if (window instanceof IdeFrameImpl) {
final BalloonLayout balloonLayout = ((IdeFrameImpl)window).getBalloonLayout();
balloonLayout.add(balloon);
if (project != null) {
Disposer.register(project, new Disposable() {
public void dispose() {
balloon.hide();
}
});
}
}
}
};
@@ -22,10 +22,13 @@ import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ProjectComponent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.Disposable;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* @author spleaner
*/
@@ -58,6 +61,11 @@ public class ProjectNotificationsComponent implements Notifications, ProjectComp
}
public void projectClosed() {
final Collection<Notification> collection = NotificationsManagerImpl.getNotificationsManagerImpl().getByType(null, myProject);
for (final Notification notification : collection) {
final Balloon balloon = notification.getBalloon();
if (balloon != null) balloon.hide();
}
}
private static boolean isDummyEnvironment() {