diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java index 327d86e5b636..d04a4a0d7125 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java +++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java @@ -19,14 +19,13 @@ package com.intellij.find.impl.livePreview; import com.intellij.codeInsight.highlighting.HighlightManager; import com.intellij.ide.IdeTooltipManager; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ScrollType; -import com.intellij.openapi.editor.VisualPosition; +import com.intellij.openapi.editor.colors.EditorColors; +import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.VisibleAreaEvent; import com.intellij.openapi.editor.event.VisibleAreaListener; -import com.intellij.openapi.editor.markup.CustomHighlighterRenderer; import com.intellij.openapi.editor.markup.EffectType; import com.intellij.openapi.editor.markup.RangeHighlighter; import com.intellij.openapi.editor.markup.TextAttributes; @@ -34,12 +33,10 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.Balloon; import com.intellij.openapi.ui.popup.BalloonBuilder; import com.intellij.openapi.ui.popup.JBPopupFactory; -import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.TextRange; import com.intellij.ui.awt.RelativePoint; import com.intellij.util.containers.HashSet; import com.intellij.util.ui.PositionTracker; -import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.Nullable; import java.awt.*; @@ -68,13 +65,15 @@ public class LivePreview extends DocumentAdapter implements ReplacementView.Dele private RangeHighlighter myCursorHighlighter; private final List myVisibleAreaListenersToRemove = new ArrayList(); - private static final TextAttributes EXCLUDED_TARGET_ATTRIBUTES = new TextAttributes(Color.BLACK, Color.YELLOW, - Color.BLACK, EffectType.STRIKEOUT, 0); + private static TextAttributes strikout(TextAttributes attributes) { + TextAttributes textAttributes = attributes.clone(); + textAttributes.setEffectColor(Color.BLACK); + textAttributes.setEffectType(EffectType.STRIKEOUT); + return textAttributes; + } private static final TextAttributes OTHER_TARGETS_ATTRIBUTES = new TextAttributes(Color.BLACK, Color.GREEN, null, null, 0); - private static final TextAttributes MAIN_TARGET_ATTRIBUTES = new TextAttributes(Color.BLACK, Color.YELLOW, null, null, 0); - private Delegate myDelegate; private SearchResults mySearchResults; @@ -206,10 +205,13 @@ public class LivePreview extends DocumentAdapter implements ReplacementView.Dele for (TextRange textRange : o.getSecondaryRanges()) { highlightRange(textRange, OTHER_TARGETS_ATTRIBUTES, myHighlighters); } + TextAttributes attrs = EditorColorsManager.getInstance(). + getGlobalScheme().getAttributes(EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES); + if (mySearchResults.isExcluded(o)) { - highlightRange(o.getPrimaryRange(), EXCLUDED_TARGET_ATTRIBUTES, myHighlighters); + highlightRange(o.getPrimaryRange(), strikout(attrs), myHighlighters); } else { - highlightRange(o.getPrimaryRange(), MAIN_TARGET_ATTRIBUTES, myHighlighters); + highlightRange(o.getPrimaryRange(), attrs, myHighlighters); } } }