diff --git a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java index e5ebb5f2d15e..78a57e77c748 100644 --- a/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java +++ b/platform/lang-impl/src/com/intellij/openapi/options/colors/pages/GeneralColorsPage.java @@ -134,6 +134,7 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.information"), HintUtil.INFORMATION_COLOR_KEY, ColorDescriptor.Kind.BACKGROUND), new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.question"), HintUtil.QUESTION_COLOR_KEY, ColorDescriptor.Kind.BACKGROUND), new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.error"), HintUtil.ERROR_COLOR_KEY, ColorDescriptor.Kind.BACKGROUND), + new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.recent.locations.selection"), HintUtil.RECENT_LOCATIONS_SELECTION_KEY, ColorDescriptor.Kind.BACKGROUND), new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.popups.tooltip"), IdeTooltipManager.TOOLTIP_COLOR_KEY, ColorDescriptor.Kind.BACKGROUND), new ColorDescriptor(OptionsBundle.message("options.general.color.descriptor.visual.guides"), EditorColors.VISUAL_INDENT_GUIDE_COLOR, ColorDescriptor.Kind.FOREGROUND), 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 83c5b76e25bf..21c98b5233fc 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintUtil.java @@ -40,6 +40,9 @@ public class HintUtil { public static final Color QUESTION_UNDERSCORE_COLOR = JBColor.foreground(); + public static final ColorKey RECENT_LOCATIONS_SELECTION_KEY = ColorKey + .createColorKey("RECENT_LOCATIONS_SELECTION", JBColor.namedColor("Table.lightSelectionBackground", new JBColor(0xE9EEF5, 0x464A4D))); + private HintUtil() { } @@ -58,6 +61,11 @@ public class HintUtil { return notNull(getGlobalOrDefaultColor(ERROR_COLOR_KEY), ERROR_COLOR_KEY.getDefaultColor()); } + @NotNull + public static Color getRecentLocationsSelectionColor() { + return notNull(getGlobalOrDefaultColor(RECENT_LOCATIONS_SELECTION_KEY), RECENT_LOCATIONS_SELECTION_KEY.getDefaultColor()); + } + public static JComponent createInformationLabel(@NotNull String text) { return createInformationLabel(text, null, null, null); } @@ -197,12 +205,12 @@ public class HintUtil { } return label; } - + @NotNull public static String prepareHintText(@NotNull String text, @NotNull HintHint hintHint) { return prepareHintText(new Html(text), hintHint); } - + public static String prepareHintText(@NotNull Html text, @NotNull HintHint hintHint) { String htmlBody = UIUtil.getHtmlBody(text); return String.format( diff --git a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java index 6832c1a79ce6..293f2af46ce0 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsAction.java @@ -33,10 +33,7 @@ import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.ui.popup.JBPopupFactory; import com.intellij.openapi.ui.popup.JBPopupListener; import com.intellij.openapi.ui.popup.LightweightWindowEvent; -import com.intellij.openapi.util.DimensionService; -import com.intellij.openapi.util.Disposer; -import com.intellij.openapi.util.Ref; -import com.intellij.openapi.util.TextRange; +import com.intellij.openapi.util.*; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ex.WindowManagerEx; @@ -151,6 +148,7 @@ public class RecentLocationsAction extends AnAction { }) .setResizable(true) .setMovable(true) + .setBorderColor(SystemInfoRt.isMac && UIUtil.isUnderDarcula() ? topPanel.getBackground() : null) .setDimensionServiceKey(project, LOCATION_SETTINGS_KEY, true) .setMinSize(new Dimension(DEFAULT_WIDTH, MINIMUM_HEIGHT)) .setLocateWithinScreenBounds(false) diff --git a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsRenderer.java b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsRenderer.java index d2139c5ee97b..db2fd8c8eab8 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsRenderer.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/RecentLocationsRenderer.java @@ -1,13 +1,17 @@ // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.actions; +import com.intellij.codeInsight.hint.HintUtil; import com.intellij.ide.actions.RecentLocationsAction.RecentLocationItem; import com.intellij.lang.Language; import com.intellij.lang.LanguageUtil; import com.intellij.navigation.ItemPresentation; import com.intellij.openapi.editor.CaretState; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.HighlighterColors; import com.intellij.openapi.editor.actions.EditorActionUtil; +import com.intellij.openapi.editor.colors.CodeInsightColors; +import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.markup.HighlighterLayer; import com.intellij.openapi.editor.markup.HighlighterTargetArea; @@ -17,6 +21,7 @@ import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.VerticalFlowLayout; import com.intellij.openapi.util.Ref; +import com.intellij.openapi.util.SystemInfoRt; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.PsiFile; @@ -24,6 +29,7 @@ import com.intellij.psi.PsiManager; import com.intellij.ui.*; import com.intellij.ui.speedSearch.SpeedSearch; import com.intellij.ui.speedSearch.SpeedSearchUtil; +import com.intellij.util.FontUtil; import com.intellij.util.ui.JBUI; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -38,8 +44,6 @@ import java.util.Map; import static com.intellij.ide.actions.RecentLocationsAction.EMPTY_FILE_TEXT; class RecentLocationsRenderer extends ColoredListCellRenderer { - private static final JBColor BACKGROUND_COLOR = JBColor.namedColor("Table.lightSelectionBackground", new JBColor(0xE9EEF5, 0x464A4D)); - @NotNull private final Project myProject; @NotNull private final SpeedSearch mySpeedSearch; @NotNull private final Ref> myBreadcrumbsMap; @@ -63,52 +67,58 @@ class RecentLocationsRenderer extends ColoredListCellRenderer list, @NotNull SpeedSearch speedSearch, @Nullable String breadcrumb, @NotNull IdeDocumentHistoryImpl.PlaceInfo placeInfo, - @NotNull Color background, - boolean selected, - int index) { + @NotNull EditorColorsScheme colorsScheme, + boolean selected) { JComponent title = JBUI.Panels .simplePanel() .withBorder(JBUI.Borders.empty()) - .addToLeft(createTitleTextComponent(project, list, speedSearch, placeInfo, breadcrumb, selected)) - .addToCenter(createTitledSeparator(background)); + .addToLeft(createTitleTextComponent(project, list, speedSearch, placeInfo, colorsScheme, breadcrumb, selected)); - title.setBorder(BorderFactory.createEmptyBorder(index == 0 ? 5 : 15, 8, 6, 0)); - title.setBackground(background); + title.setBorder(JBUI.Borders.empty(8, 6, 6, 0)); + title.setBackground(getBackgroundColor(colorsScheme, selected)); return title; } @NotNull - private static TitledSeparator createTitledSeparator(@NotNull Color background) { - TitledSeparator titledSeparator = new TitledSeparator(); - titledSeparator.setBackground(background); - return titledSeparator; + private static JPanel createSeparatorLine(@NotNull EditorColorsScheme colorsScheme) { + Color color = colorsScheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR); + if (color == null) { + color = JBColor.namedColor("Group.separatorColor", new JBColor(Gray.xCD, Gray.x51)); + } + + return JBUI.Panels.simplePanel().withBorder(JBUI.Borders.customLine(color, 1, 0, 0, 0)); } @NotNull private static JComponent setupEditorComponent(@NotNull EditorEx editor, @NotNull String text, @NotNull SpeedSearch speedSearch, - @NotNull Color backgroundColor) { + @NotNull EditorColorsScheme colorsScheme, + boolean selected) { Iterable ranges = speedSearch.matchingFragments(text); if (ranges != null) { selectSearchResultsInEditor(editor, ranges.iterator()); @@ -117,14 +127,14 @@ class RecentLocationsRenderer extends ColoredListCellRenderer list, @NotNull SpeedSearch speedSearch, @NotNull IdeDocumentHistoryImpl.PlaceInfo placeInfo, + @NotNull EditorColorsScheme colorsScheme, @Nullable String breadcrumbText, boolean selected) { SimpleColoredComponent titleTextComponent = new SimpleColoredComponent(); String fileName = placeInfo.getFile().getName(); String text = fileName; - titleTextComponent.append(fileName, SimpleTextAttributes.fromTextAttributes(createLabelForegroundTextAttributes())); + titleTextComponent.append(fileName, createFileNameTextAttributes(colorsScheme, selected)); if (StringUtil.isNotEmpty(breadcrumbText) && !StringUtil.equals(breadcrumbText, fileName)) { text += " " + breadcrumbText; titleTextComponent.append(" "); - titleTextComponent.append(breadcrumbText, SimpleTextAttributes.fromTextAttributes(createBreadcrumbsTextAttributes())); + titleTextComponent.append(breadcrumbText, createBreadcrumbsTextAttributes(colorsScheme, selected)); } Icon icon = fetchIcon(project, placeInfo); @@ -159,6 +170,10 @@ class RecentLocationsRenderer extends ColoredListCellRenderer