mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-186805 Rework plugin page: icons
This commit is contained in:
+52
-33
@@ -1622,8 +1622,7 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
protected void updateIcon(boolean errors, boolean disabled) {
|
||||
boolean jb = myPlugin.isBundled() || PluginManagerMain.isDevelopedByJetBrains(myPlugin);
|
||||
myIconLabel.setIcon(PluginLogoInfo.getIcon(false, jb, errors, disabled));
|
||||
myIconLabel.setIcon(PluginLogoInfo.getIcon(false, isJBPlugin(myPlugin), errors, disabled));
|
||||
}
|
||||
|
||||
protected void addDescriptionComponent(@NotNull JPanel parent, @Nullable String description, @NotNull LineFunction function) {
|
||||
@@ -1847,6 +1846,8 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
private void createButtons(boolean update) {
|
||||
myEnableDisableButton.setOpaque(false);
|
||||
|
||||
if (myPlugin instanceof IdeaPluginDescriptorImpl && ((IdeaPluginDescriptorImpl)myPlugin).isDeleted()) {
|
||||
myRestartButton = new RestartButton(myPluginsModel);
|
||||
myRestartButton.setFocusable(false);
|
||||
@@ -1936,7 +1937,7 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
public void updateErrors() {
|
||||
boolean errors = PluginManagerCore.isIncompatible(myPlugin) || myPluginsModel.hasProblematicDependencies(myPlugin.getPluginId());
|
||||
boolean errors = myPluginsModel.hasErrors(myPlugin);
|
||||
|
||||
updateIcon(errors, !myPluginsModel.isEnabled(myPlugin));
|
||||
|
||||
@@ -2658,8 +2659,8 @@ public class PluginManagerConfigurableNew
|
||||
header.setBorder(JBUI.Borders.emptyRight(20));
|
||||
add(header, BorderLayout.NORTH);
|
||||
|
||||
boolean jb = PluginManagerMain.isDevelopedByJetBrains(myPlugin);
|
||||
boolean errors = PluginManagerCore.isIncompatible(myPlugin) || myPluginsModel.hasProblematicDependencies(myPlugin.getPluginId());
|
||||
boolean jb = isJBPlugin(myPlugin);
|
||||
boolean errors = myPluginsModel.hasErrors(myPlugin);
|
||||
|
||||
myIconLabel = new JLabel(PluginLogoInfo.getIcon(true, jb, errors, false));
|
||||
myIconLabel.setDisabledIcon(PluginLogoInfo.getIcon(true, jb, errors, true));
|
||||
@@ -2724,7 +2725,7 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
private void createErrorPanel(@NotNull JPanel centerPanel) {
|
||||
if (PluginManagerCore.isIncompatible(myPlugin) || myPluginsModel.hasProblematicDependencies(myPlugin.getPluginId())) {
|
||||
if (myPluginsModel.hasErrors(myPlugin)) {
|
||||
JPanel errorPanel = new NonOpaquePanel(new HorizontalLayout(JBUI.scale(8)));
|
||||
errorPanel.setBorder(JBUI.Borders.emptyTop(15));
|
||||
centerPanel.add(errorPanel);
|
||||
@@ -2888,7 +2889,7 @@ public class PluginManagerConfigurableNew
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
//noinspection UseJBColor
|
||||
g.setColor(myUnderline ? new Color(myColor.getRed(), myColor.getGreen(), myColor.getBlue(), 200) : myColor);
|
||||
g.setColor(myUnderline ? new Color(myColor.getRed(), myColor.getGreen(), myColor.getBlue(), 178) : myColor);
|
||||
g.fillRect(0, 0, getWidth(), getHeight());
|
||||
super.paintComponent(g);
|
||||
}
|
||||
@@ -3277,6 +3278,14 @@ public class PluginManagerConfigurableNew
|
||||
component.updateErrors();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasErrors(@NotNull IdeaPluginDescriptor plugin) {
|
||||
return PluginManagerCore.isIncompatible(plugin) || hasProblematicDependencies(plugin.getPluginId());
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isJBPlugin(@NotNull IdeaPluginDescriptor plugin) {
|
||||
return plugin.isBundled() || PluginManagerMain.isDevelopedByJetBrains(plugin);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -3349,54 +3358,62 @@ public class PluginManagerConfigurableNew
|
||||
}
|
||||
|
||||
private static final class PluginLogoInfo {
|
||||
private static final LayeredIcon PluginLogoJB_40 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoError_40 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoJBError_40 = new LayeredIcon(3);
|
||||
private static LayeredIcon PluginLogoJB_40;
|
||||
private static LayeredIcon PluginLogoError_40;
|
||||
private static LayeredIcon PluginLogoJBError_40;
|
||||
|
||||
private static final LayeredIcon PluginLogoDisabledJB_40 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoDisabledError_40 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoDisabledJBError_40 = new LayeredIcon(3);
|
||||
private static LayeredIcon PluginLogoDisabledJB_40;
|
||||
private static LayeredIcon PluginLogoDisabledError_40;
|
||||
private static LayeredIcon PluginLogoDisabledJBError_40;
|
||||
|
||||
private static final LayeredIcon PluginLogoJB_80 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoError_80 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoJBError_80 = new LayeredIcon(3);
|
||||
private static LayeredIcon PluginLogoJB_80;
|
||||
private static LayeredIcon PluginLogoError_80;
|
||||
private static LayeredIcon PluginLogoJBError_80;
|
||||
|
||||
private static final LayeredIcon PluginLogoDisabledJB_80 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoDisabledError_80 = new LayeredIcon(2);
|
||||
private static final LayeredIcon PluginLogoDisabledJBError_80 = new LayeredIcon(3);
|
||||
private static LayeredIcon PluginLogoDisabledJB_80;
|
||||
private static LayeredIcon PluginLogoDisabledError_80;
|
||||
private static LayeredIcon PluginLogoDisabledJBError_80;
|
||||
|
||||
private static boolean myCreateIcons = true;
|
||||
|
||||
static {
|
||||
createIcons();
|
||||
LafManager.getInstance().addLafManagerListener(source -> createIcons());
|
||||
LafManager.getInstance().addLafManagerListener(source -> myCreateIcons = true);
|
||||
}
|
||||
|
||||
private static void createIcons() {
|
||||
setSouthEast(PluginLogoJB_40, AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierJBLogo);
|
||||
setSouthWest(PluginLogoError_40, AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierInvalid);
|
||||
setSouthEastWest(PluginLogoJBError_40, AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierJBLogo,
|
||||
if (!myCreateIcons) {
|
||||
return;
|
||||
}
|
||||
myCreateIcons = false;
|
||||
|
||||
setSouthEast(PluginLogoJB_40 = new LayeredIcon(2), AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierJBLogo);
|
||||
setSouthWest(PluginLogoError_40 = new LayeredIcon(2), AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierInvalid);
|
||||
setSouthEastWest(PluginLogoJBError_40 = new LayeredIcon(3), AllIcons.Plugins.PluginLogo_40, AllIcons.Plugins.ModifierJBLogo,
|
||||
AllIcons.Plugins.ModifierInvalid);
|
||||
|
||||
Icon disabledJBLogo = IconLoader.getDisabledIcon(AllIcons.Plugins.ModifierJBLogo);
|
||||
assert disabledJBLogo != null;
|
||||
|
||||
setSouthEast(PluginLogoDisabledJB_40, AllIcons.Plugins.PluginLogoDisabled_40, disabledJBLogo);
|
||||
setSouthWest(PluginLogoDisabledError_40, AllIcons.Plugins.PluginLogoDisabled_40, AllIcons.Plugins.ModifierInvalid);
|
||||
setSouthEastWest(PluginLogoDisabledJBError_40, AllIcons.Plugins.PluginLogoDisabled_40, disabledJBLogo,
|
||||
setSouthEast(PluginLogoDisabledJB_40 = new LayeredIcon(2), AllIcons.Plugins.PluginLogoDisabled_40, disabledJBLogo);
|
||||
setSouthWest(PluginLogoDisabledError_40 = new LayeredIcon(2), AllIcons.Plugins.PluginLogoDisabled_40,
|
||||
AllIcons.Plugins.ModifierInvalid);
|
||||
setSouthEastWest(PluginLogoDisabledJBError_40 = new LayeredIcon(3), AllIcons.Plugins.PluginLogoDisabled_40, disabledJBLogo,
|
||||
AllIcons.Plugins.ModifierInvalid);
|
||||
|
||||
Icon jbLogo2x = IconUtil.scale(AllIcons.Plugins.ModifierJBLogo, 2);
|
||||
Icon errorLogo2x = IconUtil.scale(AllIcons.Plugins.ModifierInvalid, 2);
|
||||
|
||||
setSouthEast(PluginLogoJB_80, AllIcons.Plugins.PluginLogo_80, jbLogo2x);
|
||||
setSouthWest(PluginLogoError_80, AllIcons.Plugins.PluginLogo_80, errorLogo2x);
|
||||
setSouthEastWest(PluginLogoJBError_80, AllIcons.Plugins.PluginLogo_80, jbLogo2x, errorLogo2x);
|
||||
setSouthEast(PluginLogoJB_80 = new LayeredIcon(2), AllIcons.Plugins.PluginLogo_80, jbLogo2x);
|
||||
setSouthWest(PluginLogoError_80 = new LayeredIcon(2), AllIcons.Plugins.PluginLogo_80, errorLogo2x);
|
||||
setSouthEastWest(PluginLogoJBError_80 = new LayeredIcon(3), AllIcons.Plugins.PluginLogo_80, jbLogo2x, errorLogo2x);
|
||||
|
||||
Icon disabledJBLogo2x = IconLoader.getDisabledIcon(jbLogo2x);
|
||||
assert disabledJBLogo2x != null;
|
||||
|
||||
setSouthEast(PluginLogoDisabledJB_80, AllIcons.Plugins.PluginLogoDisabled_80, disabledJBLogo2x);
|
||||
setSouthWest(PluginLogoDisabledError_80, AllIcons.Plugins.PluginLogoDisabled_80, errorLogo2x);
|
||||
setSouthEastWest(PluginLogoDisabledJBError_80, AllIcons.Plugins.PluginLogoDisabled_80, disabledJBLogo2x, errorLogo2x);
|
||||
setSouthEast(PluginLogoDisabledJB_80 = new LayeredIcon(2), AllIcons.Plugins.PluginLogoDisabled_80, disabledJBLogo2x);
|
||||
setSouthWest(PluginLogoDisabledError_80 = new LayeredIcon(2), AllIcons.Plugins.PluginLogoDisabled_80, errorLogo2x);
|
||||
setSouthEastWest(PluginLogoDisabledJBError_80 = new LayeredIcon(3), AllIcons.Plugins.PluginLogoDisabled_80, disabledJBLogo2x,
|
||||
errorLogo2x);
|
||||
}
|
||||
|
||||
private static void setSouthEast(@NotNull LayeredIcon layeredIcon, @NotNull Icon main, @NotNull Icon southEast) {
|
||||
@@ -3420,6 +3437,8 @@ public class PluginManagerConfigurableNew
|
||||
|
||||
@NotNull
|
||||
public static Icon getIcon(boolean big, boolean jb, boolean error, boolean disabled) {
|
||||
createIcons();
|
||||
|
||||
if (jb && !error) {
|
||||
if (big) {
|
||||
return disabled ? PluginLogoDisabledJB_80 : PluginLogoJB_80;
|
||||
|
||||
Reference in New Issue
Block a user