Search in sources :

Example 1 with EditorHyperlinkSupport

use of com.intellij.execution.impl.EditorHyperlinkSupport in project intellij by bazelbuild.

the class BlazeConsoleView method findLinkRange.

@Nullable
private RangeHighlighter findLinkRange(HyperlinkInfo link, int originalOffset) {
    // first check if it's still at the same offset
    Document doc = consoleView.getEditor().getDocument();
    if (doc.getTextLength() <= originalOffset) {
        return null;
    }
    int lineNumber = doc.getLineNumber(originalOffset);
    EditorHyperlinkSupport helper = consoleView.getHyperlinks();
    for (RangeHighlighter range : helper.findAllHyperlinksOnLine(lineNumber)) {
        if (Objects.equals(EditorHyperlinkSupport.getHyperlinkInfo(range), link)) {
            return range;
        }
    }
    // fall back to searching all hyperlinks
    return findRangeForHyperlink(link);
}
Also used : RangeHighlighter(com.intellij.openapi.editor.markup.RangeHighlighter) EditorHyperlinkSupport(com.intellij.execution.impl.EditorHyperlinkSupport) Document(com.intellij.openapi.editor.Document) Nullable(javax.annotation.Nullable)

Aggregations

EditorHyperlinkSupport (com.intellij.execution.impl.EditorHyperlinkSupport)1 Document (com.intellij.openapi.editor.Document)1 RangeHighlighter (com.intellij.openapi.editor.markup.RangeHighlighter)1 Nullable (javax.annotation.Nullable)1