mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-88507 Throwable at ToolWindowManagerImpl.notifyByBalloon() from notification
This commit is contained in:
@@ -27,6 +27,8 @@ import javax.swing.event.HyperlinkListener;
|
||||
|
||||
public abstract class ToolWindowManager {
|
||||
|
||||
public abstract boolean canShowNotification(@NotNull String toolWindowId);
|
||||
|
||||
public static ToolWindowManager getInstance(Project project){
|
||||
return project.getComponent(ToolWindowManager.class);
|
||||
}
|
||||
|
||||
+1
-2
@@ -46,7 +46,6 @@ import javax.swing.event.HyperlinkEvent;
|
||||
import javax.swing.event.HyperlinkListener;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -142,7 +141,7 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
|
||||
NotificationDisplayType type = settings.getDisplayType();
|
||||
String toolWindowId = NotificationsConfigurationImpl.getNotificationsConfigurationImpl().getToolWindowId(groupId);
|
||||
if (type == NotificationDisplayType.TOOL_WINDOW &&
|
||||
(toolWindowId == null || project == null || !Arrays.asList(ToolWindowManager.getInstance(project).getToolWindowIds()).contains(toolWindowId))) {
|
||||
(toolWindowId == null || project == null || !ToolWindowManager.getInstance(project).canShowNotification(toolWindowId))) {
|
||||
type = NotificationDisplayType.BALLOON;
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -56,6 +56,10 @@ import java.util.List;
|
||||
|
||||
@SuppressWarnings({"ConstantConditions"})
|
||||
public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
|
||||
@Override
|
||||
public boolean canShowNotification(@NotNull String toolWindowId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyByBalloon(@NotNull final String toolWindowId, @NotNull final MessageType type, @NotNull final String htmlBody) {
|
||||
|
||||
@@ -1288,6 +1288,16 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
return IdeFocusManager.getInstance(myProject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canShowNotification(@NotNull final String toolWindowId) {
|
||||
if (!Arrays.asList(getToolWindowIds()).contains(toolWindowId)) {
|
||||
return false;
|
||||
}
|
||||
final Stripe stripe = myToolWindowsPane.getStripeFor(toolWindowId);
|
||||
return stripe.getButtonFor(toolWindowId) != null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyByBalloon(@NotNull final String toolWindowId, @NotNull final MessageType type, @NotNull final String htmlBody) {
|
||||
notifyByBalloon(toolWindowId, type, htmlBody, null, null);
|
||||
|
||||
@@ -531,6 +531,12 @@ public class Mock {
|
||||
}
|
||||
|
||||
public static class MyToolWindowManager extends ToolWindowManager {
|
||||
|
||||
@Override
|
||||
public boolean canShowNotification(@NotNull String toolWindowId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolWindow registerToolWindow(@NotNull String id, @NotNull JComponent component, @NotNull ToolWindowAnchor anchor) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user