refactor UIUtil to remove isNimbus usages

This commit is contained in:
Konstantin Bulenkov
2017-11-05 14:09:39 +01:00
parent ed94eca901
commit d5158fe4e8
@@ -212,9 +212,7 @@ public class UIUtil {
public static Couple<Color> getCellColors(JTable table, boolean isSel, int row, int column) {
return Couple.of(isSel ? table.getSelectionForeground() : table.getForeground(),
isSel
? table.getSelectionBackground()
: isUnderNimbusLookAndFeel() && row % 2 == 1 ? TRANSPARENT_COLOR : table.getBackground());
isSel ? table.getSelectionBackground() : table.getBackground());
}
public static void fixOSXEditorBackground(@NotNull JTable table) {
@@ -1039,12 +1037,6 @@ public class UIUtil {
}
public static Color getTreeSelectionBackground() {
if (isUnderNimbusLookAndFeel()) {
Color color = UIManager.getColor("Tree.selectionBackground");
if (color != null) return color;
color = UIManager.getColor("nimbusSelectionBackground");
if (color != null) return color;
}
return UIManager.getColor("Tree.selectionBackground");
}
@@ -1065,12 +1057,6 @@ public class UIUtil {
}
public static Color getTableSelectionBackground() {
if (isUnderNimbusLookAndFeel()) {
Color color = UIManager.getColor("Table[Enabled+Selected].textBackground");
if (color != null) return color;
color = UIManager.getColor("nimbusSelectionBackground");
if (color != null) return color;
}
return UIManager.getColor("Table.selectionBackground");
}
@@ -1198,9 +1184,6 @@ public class UIUtil {
}
public static Color getTableSelectionForeground() {
if (isUnderNimbusLookAndFeel()) {
return UIManager.getColor("Table[Enabled+Selected].textForeground");
}
return UIManager.getColor("Table.selectionForeground");
}
@@ -1217,11 +1200,6 @@ public class UIUtil {
}
public static Color getListBackground() {
if (isUnderNimbusLookAndFeel()) {
final Color color = UIManager.getColor("List.background");
//noinspection UseJBColor
return new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
}
// Under GTK+ L&F "Table.background" often has main panel color, which looks ugly
return isUnderGTKLookAndFeel() ? getTreeTextBackground() : UIManager.getColor("List.background");
}
@@ -1259,9 +1237,6 @@ public class UIUtil {
}
public static Color getListSelectionBackground() {
if (isUnderNimbusLookAndFeel()) {
return UIManager.getColor("List[Selected].textBackground"); // Nimbus
}
return UIManager.getColor("List.selectionBackground");
}
@@ -1343,9 +1318,6 @@ public class UIUtil {
if (isUnderAlloyLookAndFeel()) {
separatorColor = getSeparatorShadow();
}
if (isUnderNimbusLookAndFeel()) {
separatorColor = getSeparatorColorUnderNimbus();
}
//under GTK+ L&F colors set hard
if (isUnderGTKLookAndFeel()) {
separatorColor = Gray._215;
@@ -1448,7 +1420,6 @@ public class UIUtil {
public static Icon getTreeSelectedCollapsedIcon() {
if (isUnderAquaBasedLookAndFeel() ||
isUnderNimbusLookAndFeel() ||
isUnderGTKLookAndFeel() ||
isUnderDarcula() ||
isUnderIntelliJLaF() &&
@@ -1460,7 +1431,6 @@ public class UIUtil {
public static Icon getTreeSelectedExpandedIcon() {
if (isUnderAquaBasedLookAndFeel() ||
isUnderNimbusLookAndFeel() ||
isUnderGTKLookAndFeel() ||
isUnderDarcula() ||
isUnderIntelliJLaF() &&
@@ -1507,19 +1477,20 @@ public class UIUtil {
}
@SuppressWarnings("HardCodedStringLiteral")
public static boolean isUnderAquaLookAndFeel() {
return SystemInfo.isMac && UIManager.getLookAndFeel().getName().contains("Mac OS X");
}
/**
* IntelliJ Platform does not support Nimbus look-n-feel
* @deprecated
*/
@SuppressWarnings("HardCodedStringLiteral")
public static boolean isUnderNimbusLookAndFeel() {
return UIManager.getLookAndFeel().getName().contains("Nimbus");
}
@SuppressWarnings("HardCodedStringLiteral")
public static boolean isUnderAquaLookAndFeel() {
return SystemInfo.isMac && UIManager.getLookAndFeel().getName().contains("Mac OS X");
}
@SuppressWarnings("HardCodedStringLiteral")
public static boolean isUnderJGoodiesLookAndFeel() {
return UIManager.getLookAndFeel().getName().contains("JGoodies");
@@ -2503,7 +2474,6 @@ public class UIUtil {
public static boolean isStandardMenuLAF() {
return isWinLafOnVista() ||
isUnderNimbusLookAndFeel() ||
isUnderGTKLookAndFeel();
}