Make use of methods to get HintHint colors

This commit is contained in:
Gregory.Shrago
2017-02-09 22:56:58 +03:00
parent 7c500cb06a
commit 59bee10675
18 changed files with 32 additions and 26 deletions
@@ -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);
}
@@ -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);
}
@@ -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);
@@ -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);
}
}
@@ -956,7 +956,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent {
List<RangeHighlighter> 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(),
@@ -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);
}
@@ -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("<html><h2> Summary of regular-expression constructs</h2> \n" +
" \n" +
@@ -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;
@@ -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();
@@ -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);
@@ -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);
}
@@ -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();
@@ -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);
@@ -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);
@@ -72,7 +72,7 @@ public class ChangeListDetailsAction extends AnAction implements DumbAware {
format("<html><head>%s</head><body>%s</body></html>", 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);
@@ -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);
@@ -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));
@@ -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);
}