From f28006786eace3f3a15d2db032502215dd030200 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Thu, 19 Feb 2015 17:14:42 +0300 Subject: [PATCH] console filter: convenient way to create inactive hyperlinks --- .../intellij/execution/filters/Filter.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/platform/lang-api/src/com/intellij/execution/filters/Filter.java b/platform/lang-api/src/com/intellij/execution/filters/Filter.java index 66cde5b4ef2a..c1df6860065f 100644 --- a/platform/lang-api/src/com/intellij/execution/filters/Filter.java +++ b/platform/lang-api/src/com/intellij/execution/filters/Filter.java @@ -15,7 +15,10 @@ */ package com.intellij.execution.filters; +import com.intellij.openapi.editor.colors.CodeInsightColors; +import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.markup.TextAttributes; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -31,6 +34,18 @@ public interface Filter { Filter[] EMPTY_ARRAY = new Filter[0]; class Result extends ResultItem { + + private static final TextAttributes INACTIVE_HYPERLINK_ATTRIBUTES; + static { + TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES); + if (attributes != null) { + attributes = attributes.clone(); + attributes.setForegroundColor(UIUtil.getInactiveTextColor()); + attributes.setEffectColor(UIUtil.getInactiveTextColor()); + } + INACTIVE_HYPERLINK_ATTRIBUTES = attributes; + } + protected NextAction myNextAction = NextAction.EXIT; protected final List myResultItems; @@ -46,6 +61,14 @@ public interface Filter { myResultItems = null; } + public Result(final int highlightStartOffset, + final int highlightEndOffset, + @Nullable final HyperlinkInfo hyperlinkInfo, + boolean inactiveHyperlink) { + super(highlightStartOffset, highlightEndOffset, hyperlinkInfo, inactiveHyperlink ? INACTIVE_HYPERLINK_ATTRIBUTES : null); + myResultItems = null; + } + public Result(@NotNull List resultItems) { super(-1, -1, null, null); myResultItems = resultItems;