From 245be42457307bd91cce0ecfa52bca505bbcd4e5 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Wed, 1 Mar 2017 17:27:38 +0100 Subject: [PATCH] cleanup and fix warnings --- .../ide/ui/laf/darcula/DarculaUIUtil.java | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaUIUtil.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaUIUtil.java index 83eea37fc1ab..335bd44f4195 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaUIUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/DarculaUIUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.intellij.ide.ui.laf.darcula; import com.intellij.ide.IdeEventQueue; -import com.intellij.openapi.util.SystemInfo; import com.intellij.ui.ColorUtil; import com.intellij.ui.JBColor; import com.intellij.util.ui.JBUI; @@ -39,21 +38,16 @@ import static javax.swing.SwingConstants.WEST; public class DarculaUIUtil { private static final Color GLOW_COLOR = new JBColor(new Color(31, 121, 212), new Color(96, 175, 255)); - private static final Color ACTIVE_ERROR_COLOR = new JBColor(() -> { - if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) { - return new Color(0x80ff0f0f, true); - } else { - return (UIUtil.isUnderDarcula()) ? new Color(0x8b3c3c) : new Color(0xe53e4d); - } - }); + @SuppressWarnings("UseJBColor") + private static final Color MAC_ACTIVE_ERROR_COLOR = new Color(0x80ff0f0f, true); + private static final JBColor DEFAULT_ACTIVE_ERROR_COLOR = new JBColor(0xe53e4d, 0x8b3c3c); - private static final Color INACTIVE_ERROR_COLOR = new JBColor(() -> { - if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) { - return new Color(0x80f2aaaa, true); - } else { - return (UIUtil.isUnderDarcula()) ? new Color(0x725252) : new Color(0xebbcbc); - } - }); + @SuppressWarnings("UseJBColor") + private static final Color MAC_INACTIVE_ERROR_COLOR = new Color(0x80f2aaaa, true); + private static final JBColor DEFAULT_INACTIVE_ERROR_COLOR = new JBColor(0xebbcbc, 0x725252); + + private static final Color ACTIVE_ERROR_COLOR = new JBColor(() -> UIUtil.isUnderDefaultMacTheme() ? MAC_ACTIVE_ERROR_COLOR : DEFAULT_ACTIVE_ERROR_COLOR); + private static final Color INACTIVE_ERROR_COLOR = new JBColor(() -> UIUtil.isUnderDefaultMacTheme() ? MAC_INACTIVE_ERROR_COLOR : DEFAULT_INACTIVE_ERROR_COLOR); public static void paintFocusRing(Graphics g, Rectangle bounds) { MacUIUtil.paintFocusRing((Graphics2D)g, GLOW_COLOR, bounds); @@ -115,7 +109,7 @@ public class DarculaUIUtil { } public static void paintErrorBorder(Graphics2D g, int width, int height, boolean hasFocus) { - int lw = SystemInfo.isMac && UIUtil.isUnderIntelliJLaF() ? JBUI.scale(3) : JBUI.scale(2); + int lw = JBUI.scale(UIUtil.isUnderDefaultMacTheme() ? 3 : 2); Shape shape = new RoundRectangle2D.Double(lw, lw, width - lw * 2, height - lw * 2, lw, lw); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);