From 59bee1067547acf5a9ee7fae790c8f3af86022e6 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Thu, 9 Feb 2017 22:43:24 +0300 Subject: [PATCH] Make use of methods to get HintHint colors --- .../configuration/artifacts/ArtifactEditorImpl.java | 2 +- .../intellij/diff/impl/DiffRequestProcessor.java | 2 +- .../intellij/dvcs/push/ui/VcsCommitInfoBalloon.java | 2 +- .../codeInsight/hint/ParameterInfoComponent.java | 13 +++++-------- .../codeInsight/navigation/CtrlMouseHandler.java | 2 +- .../navigation/IncrementalSearchHandler.java | 2 +- .../src/com/intellij/find/impl/RegExHelpPopup.java | 2 +- .../ide/actions/GotoRelatedSymbolAction.java | 2 +- .../packageDependencies/ui/DependenciesPanel.java | 7 +++++-- .../src/com/intellij/codeInsight/hint/HintUtil.java | 3 +++ .../src/com/intellij/ide/IdeTooltipManager.java | 2 +- .../src/com/intellij/ui/SlideComponent.java | 7 +++++-- .../src/com/intellij/ui/popup/AbstractPopup.java | 2 +- .../com/intellij/remoteServer/util/TooltipUtil.java | 2 +- .../changes/committed/ChangeListDetailsAction.java | 2 +- .../intellij/xdebugger/impl/ui/DebuggerUIUtil.java | 2 +- .../plugins/xpathView/XPathAppComponent.java | 2 +- .../navigation/NavigationGutterIconRenderer.java | 2 +- 18 files changed, 32 insertions(+), 26 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java index 90b1721fc8f4..b601fc6b71c5 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/artifacts/ArtifactEditorImpl.java @@ -235,7 +235,7 @@ public class ArtifactEditorImpl implements ArtifactEditorEx { protected void hyperlinkActivated(HyperlinkEvent e) { final JLabel label = new JLabel(ProjectBundle.message("artifact.source.items.tree.tooltip")); label.setBorder(HintUtil.createHintBorder()); - label.setBackground(HintUtil.INFORMATION_COLOR); + label.setBackground(HintUtil.getInformationColor()); label.setOpaque(true); HintManager.getInstance().showHint(label, RelativePoint.getSouthWestOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1); } diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java index e465cc23bb68..93949e1a3c0d 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffRequestProcessor.java @@ -753,7 +753,7 @@ public abstract class DiffRequestProcessor implements Disposable { .setPreferredPosition(above ? Balloon.Position.above : Balloon.Position.below) .setAwtTooltip(true) .setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)) - .setTextBg(HintUtil.INFORMATION_COLOR) + .setTextBg(HintUtil.getInformationColor()) .setShowImmediately(true); } diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/VcsCommitInfoBalloon.java b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/VcsCommitInfoBalloon.java index 0bda5ea5548c..015f5baadd04 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/VcsCommitInfoBalloon.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/push/ui/VcsCommitInfoBalloon.java @@ -51,7 +51,7 @@ public class VcsCommitInfoBalloon { myEditorPane = new JEditorPane(UIUtil.HTML_MIME, ""); myEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); myEditorPane.setEditable(false); - myEditorPane.setBackground(HintUtil.INFORMATION_COLOR); + myEditorPane.setBackground(HintUtil.getInformationColor()); myEditorPane.setFont(VcsHistoryUtil.getCommitDetailsFont()); myEditorPane.setBorder(HintUtil.createHintBorder()); Border margin = IdeBorderFactory.createEmptyBorder(3, 3, 3, 3); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java index f059ba65b350..e2c530389028 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ParameterInfoComponent.java @@ -23,10 +23,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiElement; -import com.intellij.ui.Gray; -import com.intellij.ui.JBColor; -import com.intellij.ui.ScrollPaneFactory; -import com.intellij.ui.SideBorder; +import com.intellij.ui.*; import com.intellij.util.Function; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.accessibility.AccessibleContextUtil; @@ -50,8 +47,6 @@ public class ParameterInfoComponent extends JPanel { private final OneElementComponent[] myPanels; - private static final Color BACKGROUND_COLOR = HintUtil.INFORMATION_COLOR; - private static final Color HIGHLIGHTED_BORDER_COLOR = new JBColor(new Color(231, 254, 234), Gray._100); private final Font NORMAL_FONT; private final Font BOLD_FONT; @@ -106,7 +101,7 @@ public class ParameterInfoComponent extends JPanel { myObjects = objects; - setBackground(BACKGROUND_COLOR); + setBackground(HintUtil.getInformationColor()); myHandler = handler; myPanels = new OneElementComponent[myObjects.length]; @@ -209,7 +204,9 @@ public class ParameterInfoComponent extends JPanel { @Override public Color getDefaultParameterColor() { - return myObjects[i].equals(myHighlighted) ? HIGHLIGHTED_BORDER_COLOR : BACKGROUND_COLOR; + Color color = HintUtil.getInformationColor(); + return !myObjects[i].equals(myHighlighted) ? color : + ColorUtil.isDark(color) ? ColorUtil.brighter(color, 2) : ColorUtil.darker(color, 2); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java index a3ec7dd6eef0..87105059cb95 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java @@ -956,7 +956,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent { List highlighters = new ArrayList<>(); TextAttributes attributes = info.isNavigatable() ? myEditorColorsManager.getGlobalScheme().getAttributes(EditorColors.REFERENCE_HYPERLINK_COLOR) - : new TextAttributes(null, HintUtil.INFORMATION_COLOR, null, null, Font.PLAIN); + : new TextAttributes(null, HintUtil.getInformationColor(), null, null, Font.PLAIN); for (TextRange range : info.getRanges()) { TextAttributes attr = NavigationUtil.patchAttributesColor(attributes, range, editor); final RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(range.getStartOffset(), range.getEndOffset(), diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/IncrementalSearchHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/IncrementalSearchHandler.java index deabccbd814b..b28235f0dea4 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/IncrementalSearchHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/IncrementalSearchHandler.java @@ -328,7 +328,7 @@ public class IncrementalSearchHandler { private static class MyLabel extends JLabel { public MyLabel(String text) { super(text); - this.setBackground(HintUtil.INFORMATION_COLOR); + this.setBackground(HintUtil.getInformationColor()); this.setForeground(JBColor.foreground()); this.setOpaque(true); } diff --git a/platform/lang-impl/src/com/intellij/find/impl/RegExHelpPopup.java b/platform/lang-impl/src/com/intellij/find/impl/RegExHelpPopup.java index 7db0b1a1e9c0..6c5fdbb4b755 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/RegExHelpPopup.java +++ b/platform/lang-impl/src/com/intellij/find/impl/RegExHelpPopup.java @@ -53,7 +53,7 @@ public class RegExHelpPopup extends JPanel { myEditorPane.setEditable(false); myEditorPane.setEditorKit(new HTMLEditorKit()); myEditorPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); - myEditorPane.setBackground(HintUtil.INFORMATION_COLOR); + myEditorPane.setBackground(HintUtil.getInformationColor()); myEditorPane.setText("

Summary of regular-expression constructs

\n" + " \n" + diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java index 796b4b389541..7bd513e30549 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoRelatedSymbolAction.java @@ -59,7 +59,7 @@ public class GotoRelatedSymbolAction extends AnAction { label.setBorder(IdeBorderFactory.createEmptyBorder(2, 7, 2, 7)); JBPopupFactory.getInstance().createBalloonBuilder(label) .setFadeoutTime(3000) - .setFillColor(HintUtil.ERROR_COLOR) + .setFillColor(HintUtil.getErrorColor()) .createBalloon() .show(JBPopupFactory.getInstance().guessBestPopupLocation(dataContext), Balloon.Position.above); return; diff --git a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java index 0d82f89596e4..da6bba85e5e5 100644 --- a/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java +++ b/platform/lang-impl/src/com/intellij/packageDependencies/ui/DependenciesPanel.java @@ -58,7 +58,10 @@ import com.intellij.ui.*; import com.intellij.ui.content.Content; import com.intellij.ui.treeStructure.Tree; import com.intellij.usageView.UsageViewBundle; -import com.intellij.util.*; +import com.intellij.util.EditSourceOnDoubleClickHandler; +import com.intellij.util.PlatformIcons; +import com.intellij.util.Processor; +import com.intellij.util.SystemProperties; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import com.intellij.xml.util.XmlStringUtil; @@ -805,7 +808,7 @@ public class DependenciesPanel extends JPanel implements Disposable, DataProvide }); final JEditorPane pane = new JEditorPane(UIUtil.HTML_MIME, XmlStringUtil.wrapInHtml(buf)); pane.setForeground(JBColor.foreground()); - pane.setBackground(HintUtil.INFORMATION_COLOR); + pane.setBackground(HintUtil.getInformationColor()); pane.setOpaque(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(pane); final Dimension dimension = pane.getPreferredSize(); diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java index e70b375cbcf5..1e0efd3fe52d 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java @@ -39,10 +39,13 @@ import static com.intellij.util.ObjectUtils.notNull; public class HintUtil { /** @deprecated use getInformationColor() */ + @Deprecated public static final Color INFORMATION_COLOR = new JBColor(new Color(253, 254, 226), new Color(0x4d4f51)); /** @deprecated use getQuestionColor() */ + @Deprecated public static final Color QUESTION_COLOR = new JBColor(new Color(181, 208, 251), new Color(55, 108, 137)); /** @deprecated use getErrorColor() */ + @Deprecated public static final Color ERROR_COLOR = new JBColor(new Color(255, 220, 220), new Color(0x781732)); public static final ColorKey INFORMATION_COLOR_KEY = ColorKey.createColorKey("INFORMATION_HINT", INFORMATION_COLOR); diff --git a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java index 7b4eb8a15c48..33c3b0da0a83 100644 --- a/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java +++ b/platform/platform-impl/src/com/intellij/ide/IdeTooltipManager.java @@ -652,7 +652,7 @@ public class IdeTooltipManager implements ApplicationComponentAdapter, Disposabl public static void setColors(JComponent pane) { pane.setForeground(JBColor.foreground()); - pane.setBackground(HintUtil.INFORMATION_COLOR); + pane.setBackground(HintUtil.getInformationColor()); pane.setOpaque(true); } diff --git a/platform/platform-impl/src/com/intellij/ui/SlideComponent.java b/platform/platform-impl/src/com/intellij/ui/SlideComponent.java index 9a99b427b41b..f6165bb108ff 100644 --- a/platform/platform-impl/src/com/intellij/ui/SlideComponent.java +++ b/platform/platform-impl/src/com/intellij/ui/SlideComponent.java @@ -24,7 +24,10 @@ import com.intellij.util.ui.UIUtil; import javax.swing.*; import java.awt.*; -import java.awt.event.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import java.util.List; /** @@ -138,7 +141,7 @@ class SlideComponent extends JComponent { .setBorderColor(Color.BLACK) .setAwtTooltip(true) .setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD)) - .setTextBg(HintUtil.INFORMATION_COLOR) + .setTextBg(HintUtil.getInformationColor()) .setShowImmediately(true); final Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java index a4b55a590e0a..05df137a5d99 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/AbstractPopup.java @@ -1768,7 +1768,7 @@ public class AbstractPopup implements JBPopup { public void setWarning(@NotNull String text) { JBLabel label = new JBLabel(text, UIUtil.getBalloonWarningIcon(), SwingConstants.CENTER); label.setOpaque(true); - Color color = HintUtil.INFORMATION_COLOR; + Color color = HintUtil.getInformationColor(); label.setBackground(color); label.setBorder(BorderFactory.createLineBorder(color, 3)); myHeaderPanel.add(label, BorderLayout.SOUTH); diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/TooltipUtil.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/TooltipUtil.java index 126dee1b7b1c..b5969e4bcd89 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/TooltipUtil.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/TooltipUtil.java @@ -25,7 +25,7 @@ public class TooltipUtil { protected void hyperlinkActivated(HyperlinkEvent e) { final JLabel label = new JLabel(message); label.setBorder(HintUtil.createHintBorder()); - label.setBackground(HintUtil.INFORMATION_COLOR); + label.setBackground(HintUtil.getInformationColor()); label.setOpaque(true); HintManager.getInstance() .showHint(label, RelativePoint.getSouthEastOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangeListDetailsAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangeListDetailsAction.java index 7ef1e948dca3..0caff6e443c5 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangeListDetailsAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/ChangeListDetailsAction.java @@ -72,7 +72,7 @@ public class ChangeListDetailsAction extends AnAction implements DumbAware { format("%s%s", getCssFontDeclaration(getLabelFont()), getDetails(project, changeList)); JEditorPane editorPane = new JEditorPane(HTML_MIME, details); editorPane.setEditable(false); - editorPane.setBackground(HintUtil.INFORMATION_COLOR); + editorPane.setBackground(HintUtil.getInformationColor()); editorPane.select(0, 0); editorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java index a48cd3413592..5eac17b25e76 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java @@ -130,7 +130,7 @@ public class DebuggerUIUtil { public static void showValuePopup(@NotNull XFullValueEvaluator evaluator, @NotNull MouseEvent event, @NotNull Project project, @Nullable Editor editor) { EditorTextField textArea = new TextViewer("Evaluating...", project); - textArea.setBackground(HintUtil.INFORMATION_COLOR); + textArea.setBackground(HintUtil.getInformationColor()); final FullValueEvaluationCallbackImpl callback = new FullValueEvaluationCallbackImpl(textArea); evaluator.startEvaluation(callback); diff --git a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java index 1e247b958bb6..b1b3683c42df 100644 --- a/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java +++ b/plugins/xpath/xpath-view/src/org/intellij/plugins/xpathView/XPathAppComponent.java @@ -212,7 +212,7 @@ public class XPathAppComponent implements ApplicationComponentAdapter, Persisten BorderFactory.createBevelBorder(BevelBorder.RAISED, Color.WHITE, Gray._128), BorderFactory.createEmptyBorder(3, 5, 3, 5))); label.setForeground(JBColor.foreground()); - label.setBackground(HintUtil.INFORMATION_COLOR); + label.setBackground(HintUtil.getInformationColor()); label.setOpaque(true); label.setFont(label.getFont().deriveFont(Font.BOLD)); diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java index f1ebdea7e8ed..d3682d34b0a6 100644 --- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java +++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java @@ -122,7 +122,7 @@ public abstract class NavigationGutterIconRenderer extends GutterIconRenderer label.setBorder(IdeBorderFactory.createEmptyBorder(2, 7, 2, 7)); JBPopupFactory.getInstance().createBalloonBuilder(label) .setFadeoutTime(3000) - .setFillColor(HintUtil.ERROR_COLOR) + .setFillColor(HintUtil.getErrorColor()) .createBalloon() .show(new RelativePoint(event), Balloon.Position.above); }