From 47deb16efcde9cf83f9d0e5d7e1474bb4ecf45bc Mon Sep 17 00:00:00 2001 From: Maxim Shafirov Date: Mon, 21 Feb 2005 22:22:57 +0300 Subject: [PATCH] IDEA-574. Search results error mark color should be configurable by error mark color, not background color. --- .../highlighting/HighlightManagerImpl.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/source/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java b/source/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java index d12d71dce740..9220bf59c261 100644 --- a/source/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java +++ b/source/com/intellij/codeInsight/highlighting/HighlightManagerImpl.java @@ -153,10 +153,7 @@ public class HighlightManagerImpl extends HighlightManager implements ProjectCom if (hideByTextChange) { flags |= HighlightManagerImpl.HIDE_BY_TEXT_CHANGE; } - Color scrollmarkColor = null; - if (attributes.getBackgroundColor() != null) { - scrollmarkColor = attributes.getBackgroundColor().darker(); - } + Color scrollmarkColor = getScrollMarkColor(attributes); for (int i = 0; i < occurrences.length; i++) { PsiReference occurrence = occurrences[i]; @@ -177,10 +174,7 @@ public class HighlightManagerImpl extends HighlightManager implements ProjectCom if (hideByTextChange) { flags |= HighlightManagerImpl.HIDE_BY_TEXT_CHANGE; } - Color scrollmarkColor = null; - if (attributes.getBackgroundColor() != null) { - scrollmarkColor = attributes.getBackgroundColor().darker(); - } + Color scrollmarkColor = getScrollMarkColor(attributes); for (int i = 0; i < elements.length; i++) { final PsiElement element = elements[i]; @@ -213,10 +207,8 @@ public class HighlightManagerImpl extends HighlightManager implements ProjectCom if (hideByTextChange) { flags |= HighlightManagerImpl.HIDE_BY_TEXT_CHANGE; } - Color scrollmarkColor = null; - if (attributes.getBackgroundColor() != null) { - scrollmarkColor = attributes.getBackgroundColor().darker(); - } + + Color scrollmarkColor = getScrollMarkColor(attributes); addOccurrenceHighlight(editor, startOffset, endOffset, attributes, flags, highlighters, scrollmarkColor); } @@ -229,10 +221,8 @@ public class HighlightManagerImpl extends HighlightManager implements ProjectCom if (hideByTextChange) { flags |= HighlightManagerImpl.HIDE_BY_TEXT_CHANGE; } - Color scrollmarkColor = null; - if (attributes.getBackgroundColor() != null) { - scrollmarkColor = attributes.getBackgroundColor().darker(); - } + + Color scrollmarkColor = getScrollMarkColor(attributes); for (int i = 0; i < elements.length; i++) { PsiElement element = elements[i]; @@ -243,6 +233,12 @@ public class HighlightManagerImpl extends HighlightManager implements ProjectCom } } + private Color getScrollMarkColor(final TextAttributes attributes) { + if (attributes.getErrorStripeColor() != null) return attributes.getErrorStripeColor(); + if (attributes.getBackgroundColor() != null) return attributes.getBackgroundColor().darker(); + return null; + } + public boolean hideHighlights(Editor editor, int mask) { ArrayList highlightersToRemove = new ArrayList();