mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
console filter: convenient way to create inactive hyperlinks
This commit is contained in:
@@ -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<ResultItem> 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<ResultItem> resultItems) {
|
||||
super(-1, -1, null, null);
|
||||
myResultItems = resultItems;
|
||||
|
||||
Reference in New Issue
Block a user