IDEA-153807 Welcome screen notifications
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 425 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 425 B |
|
After Width: | Height: | Size: 308 B |
|
After Width: | Height: | Size: 606 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 425 B |
@@ -97,7 +97,7 @@ public class ActivateToolWindowAction extends DumbAwareAction {
|
||||
presentation.setDescription(IdeBundle.message("action.activate.tool.window", title));
|
||||
Icon icon = toolWindow.getIcon();
|
||||
if (EventLog.LOG_TOOL_WINDOW_ID.equals(myToolWindowId)) {
|
||||
icon = AllIcons.Ide.Info_notifications;
|
||||
icon = AllIcons.Ide.Notification.InfoEvents;
|
||||
}
|
||||
presentation.setIcon(icon == null ? null : new SizedIcon(icon, icon.getIconHeight(), icon.getIconHeight()));
|
||||
}
|
||||
|
||||
@@ -26,13 +26,13 @@ import com.intellij.notification.NotificationType;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.CustomStatusBarWidget;
|
||||
import com.intellij.openapi.wm.IconLikeCustomStatusBarWidget;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.ui.ClickListener;
|
||||
import com.intellij.ui.LayeredIcon;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
|
||||
@Nullable
|
||||
private Project getProject() {
|
||||
return CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext((Component) myStatusBar));
|
||||
return CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext((Component)myStatusBar));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -126,10 +126,14 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
|
||||
private LayeredIcon createIconWithNotificationCount(ArrayList<Notification> notifications) {
|
||||
LayeredIcon icon = new LayeredIcon(2);
|
||||
Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notifications, getMaximumType(notifications));
|
||||
NotificationType type = getMaximumType(notifications);
|
||||
Icon statusIcon = getPendingNotificationsIcon(AllIcons.Ide.Notification.NoEvents, type);
|
||||
icon.setIcon(statusIcon, 0);
|
||||
if (notifications.size() > 0) {
|
||||
icon.setIcon(new TextIcon(this, String.valueOf(notifications.size())), 1, statusIcon.getIconWidth() - 2, 0);
|
||||
int size = notifications.size();
|
||||
if (size > 0) {
|
||||
//noinspection UseJBColor
|
||||
Color textColor = type == NotificationType.ERROR ? Color.white : Color.black;
|
||||
icon.setIcon(new TextIcon(this, size < 10 ? String.valueOf(size) : "9+", textColor), 1);
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
@@ -142,9 +146,12 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
private static Icon getPendingNotificationsIcon(Icon defIcon, final NotificationType maximumType) {
|
||||
if (maximumType != null) {
|
||||
switch (maximumType) {
|
||||
case WARNING: return AllIcons.Ide.Warning_notifications;
|
||||
case ERROR: return AllIcons.Ide.Error_notifications;
|
||||
case INFORMATION: return AllIcons.Ide.Info_notifications;
|
||||
case WARNING:
|
||||
return AllIcons.Ide.Notification.WarningEvents;
|
||||
case ERROR:
|
||||
return AllIcons.Ide.Notification.ErrorEvents;
|
||||
case INFORMATION:
|
||||
return AllIcons.Ide.Notification.InfoEvents;
|
||||
}
|
||||
}
|
||||
return defIcon;
|
||||
@@ -172,12 +179,14 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
private static class TextIcon implements Icon {
|
||||
private final String myStr;
|
||||
private final JComponent myComponent;
|
||||
private final Color myTextColor;
|
||||
private final int myWidth;
|
||||
|
||||
public TextIcon(JComponent component, @NotNull String str) {
|
||||
public TextIcon(JComponent component, @NotNull String str, @NotNull Color textColor) {
|
||||
myStr = str;
|
||||
myComponent = component;
|
||||
myWidth = myComponent.getFontMetrics(calcFont()).stringWidth(myStr) + 1;
|
||||
myTextColor = textColor;
|
||||
myWidth = myComponent.getFontMetrics(calcFont()).stringWidth(myStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,9 +218,14 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
Font originalFont = g.getFont();
|
||||
Color originalColor = g.getColor();
|
||||
g.setFont(calcFont());
|
||||
y += getIconHeight() - g.getFontMetrics().getDescent();
|
||||
|
||||
g.setColor(UIUtil.getLabelForeground());
|
||||
x += (getIconWidth() - myWidth) / 2;
|
||||
y += getIconHeight() / 2 + g.getFontMetrics().getDescent();
|
||||
if (!SystemInfo.isLinux && myStr.length() > 1) {
|
||||
x++;
|
||||
}
|
||||
|
||||
g.setColor(myTextColor);
|
||||
g.drawString(myStr, x, y);
|
||||
|
||||
g.setFont(originalFont);
|
||||
@@ -219,17 +233,21 @@ public class IdeNotificationArea extends JLabel implements CustomStatusBarWidget
|
||||
}
|
||||
|
||||
private Font calcFont() {
|
||||
return myComponent.getFont().deriveFont(Font.BOLD).deriveFont((float) getIconHeight() * 3 / 5);
|
||||
float size = (float)getIconHeight() * 3 / 5;
|
||||
if (myStr.length() > 1) {
|
||||
size--;
|
||||
}
|
||||
return myComponent.getFont().deriveFont(size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconWidth() {
|
||||
return myWidth;
|
||||
return AllIcons.Ide.Notification.NoEvents.getIconWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return AllIcons.Ide.Notifications.getIconHeight();
|
||||
return AllIcons.Ide.Notification.NoEvents.getIconHeight();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
<virtualFileSystem key="https" implementationClass="com.intellij.openapi.vfs.impl.http.HttpsFileSystem"/>
|
||||
|
||||
<toolWindow id="Event Log" anchor="bottom" secondary="true"
|
||||
icon="AllIcons.Ide.NoNotifications13"
|
||||
icon="AllIcons.Ide.Notification.NoEvents"
|
||||
factoryClass="com.intellij.notification.EventLogToolWindowFactory"/>
|
||||
|
||||
<projectService serviceInterface="com.intellij.openapi.wm.impl.ProjectFrameBounds"
|
||||
|
||||
@@ -642,10 +642,13 @@ public class AllIcons {
|
||||
public static final Icon Collapse = IconLoader.getIcon("/ide/notification/collapse.png"); // 16x16
|
||||
public static final Icon CollapseHover = IconLoader.getIcon("/ide/notification/collapseHover.png"); // 16x16
|
||||
public static final Icon DropTriangle = IconLoader.getIcon("/ide/notification/dropTriangle.png"); // 11x8
|
||||
public static final Icon ErrorEvents = IconLoader.getIcon("/ide/notification/errorEvents.png"); // 16x16
|
||||
public static final Icon Expand = IconLoader.getIcon("/ide/notification/expand.png"); // 16x16
|
||||
public static final Icon ExpandHover = IconLoader.getIcon("/ide/notification/expandHover.png"); // 16x16
|
||||
public static final Icon Gear = IconLoader.getIcon("/ide/notification/gear.png"); // 16x16
|
||||
public static final Icon GearHover = IconLoader.getIcon("/ide/notification/gearHover.png"); // 16x16
|
||||
public static final Icon InfoEvents = IconLoader.getIcon("/ide/notification/infoEvents.png"); // 16x16
|
||||
public static final Icon NoEvents = IconLoader.getIcon("/ide/notification/noEvents.png"); // 16x16
|
||||
|
||||
public static class Shadow {
|
||||
public static final Icon Bottom_left = IconLoader.getIcon("/ide/notification/shadow/bottom-left.png"); // 14x16
|
||||
@@ -658,6 +661,7 @@ public class AllIcons {
|
||||
public static final Icon Top = IconLoader.getIcon("/ide/notification/shadow/top.png"); // 4x4
|
||||
|
||||
}
|
||||
public static final Icon WarningEvents = IconLoader.getIcon("/ide/notification/warningEvents.png"); // 16x16
|
||||
|
||||
}
|
||||
public static final Icon Notifications = IconLoader.getIcon("/ide/notifications.png"); // 16x16
|
||||
|
||||