From ee4e64280295008486e093e9c1aad2d29a71ad8a Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 20 Oct 2013 17:16:10 +0200 Subject: [PATCH] don't clone text attributes for each console hyperlink (IDEA-114275) --- .../execution/filters/ExceptionWorker.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java b/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java index 6a310dae1a50..3fcd9c959a50 100644 --- a/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java +++ b/java/openapi/src/com/intellij/execution/filters/ExceptionWorker.java @@ -46,7 +46,17 @@ public class ExceptionWorker { private static final String AT_PREFIX = AT + " "; private static final String STANDALONE_AT = " " + AT + " "; - private static final TextAttributes HYPERLINK_ATTRIBUTES = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES); + private static final TextAttributes HYPERLINK_ATTRIBUTES; + private static final TextAttributes LIBRARY_HYPERLINK_ATTRIBUTES; + + static { + HYPERLINK_ATTRIBUTES = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES); + + LIBRARY_HYPERLINK_ATTRIBUTES = HYPERLINK_ATTRIBUTES.clone(); + Color libTextColor = UIUtil.getInactiveTextColor(); + LIBRARY_HYPERLINK_ATTRIBUTES.setForegroundColor(libTextColor); + LIBRARY_HYPERLINK_ATTRIBUTES.setEffectColor(libTextColor); + } private final Project myProject; private final GlobalSearchScope mySearchScope; @@ -107,12 +117,8 @@ public class ExceptionWorker { HyperlinkInfo linkInfo = new MyHyperlinkInfo(myProject, virtualFile, lineNumber); - TextAttributes attributes = HYPERLINK_ATTRIBUTES.clone(); - if (!ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(virtualFile)) { - Color color = UIUtil.getInactiveTextColor(); - attributes.setForegroundColor(color); - attributes.setEffectColor(color); - } + boolean inContent = ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(virtualFile); + TextAttributes attributes = inContent ? HYPERLINK_ATTRIBUTES : LIBRARY_HYPERLINK_ATTRIBUTES; myResult = new Filter.Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes); } catch (NumberFormatException e) {