com.intellij.execution.filters.HyperlinkInfo Java Examples

The following examples show how to use com.intellij.execution.filters.HyperlinkInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicFormatFilter.java    From CppTools with Apache License 2.0 6 votes vote down vote up
private static HyperlinkInfo createHyperLink(final VirtualFile child1, final int lineNumber, final int columnNumber) {
  return new HyperlinkInfo() {
    public void navigate(Project project) {
      new OpenFileDescriptor(project, child1).navigate(lineNumber == 0);

      if (lineNumber != 0) {
        final FileEditor[] fileEditors = FileEditorManager.getInstance(project).getEditors(child1);

        Editor editor = null;

        for(FileEditor fe:fileEditors) {
          if (fe instanceof TextEditor) {
            editor = ((TextEditor)fe).getEditor();
            break;
          }
        }

        if (editor != null) {
          int offset = editor.getDocument().getLineStartOffset(lineNumber - 1) + (columnNumber != 0?columnNumber - 1:0);
          new OpenFileDescriptor(project, child1,offset).navigate(true);
        }
      }
    }
  };

}
 
Example #2
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
public Runnable getLinkNavigationRunnable(final LogicalPosition logical) {
  if (EditorUtil.inVirtualSpace(myEditor, logical)) {
    return null;
  }

  final RangeHighlighter range = findLinkRangeAt(myEditor.logicalPositionToOffset(logical));
  if (range != null) {
    final HyperlinkInfo hyperlinkInfo = getHyperlinkInfo(range);
    if (hyperlinkInfo != null) {
      return () -> {
        if (hyperlinkInfo instanceof HyperlinkInfoBase) {
          final Point point = myEditor.logicalPositionToXY(logical);
          final MouseEvent event = new MouseEvent(myEditor.getContentComponent(), 0, 0, 0, point.x, point.y, 1, false);
          ((HyperlinkInfoBase)hyperlinkInfo).navigate(myProject, new RelativePoint(event));
        }
        else {
          hyperlinkInfo.navigate(myProject);
        }
        linkFollowed(myEditor, getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor), range);
      };
    }
  }
  return null;
}
 
Example #3
Source File: GoToTabFilter.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 6 votes vote down vote up
private Optional<Result> createLink(String textLine, int endPoint, String linkText, String tabName) {
    int startPoint = endPoint - textLine.length();

    int tabLinkPos = textLine.lastIndexOf(linkText);
    if (tabLinkPos > -1) {
        HyperlinkInfo gotoTab = e -> {
            if (log.getContentSize() - 1 == endPoint) {
                e.getMessageBus().syncPublisher(OpenTabEvent.OPEN_TAB_TOPIC).openTab(tabName);
            } else {
                showPopup("Query results outdated", "Please run query again");
            }
        };

        Result graphTabLink = new Result(
            startPoint + tabLinkPos,
            startPoint + tabLinkPos + linkText.length(),
            gotoTab);

        return Optional.of(graphTabLink);
    }
    return Optional.empty();
}
 
Example #4
Source File: ErrorFilter.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public Result applyFilter(String s, int i) {
  if(s.indexOf(START_TOKEN) == -1) {
    return null;
  }
  int classAndLineIndex = START_TOKEN.length();
  int openBraceIndex = s.indexOf("(");
  int closeBraceIndex = s.indexOf(")");

  String classAndLine = s.substring(classAndLineIndex, openBraceIndex);
  Integer lineNumber = Integer.parseInt(classAndLine.substring(classAndLine.indexOf(":") + 1));

  String classAndFunction = s.substring(openBraceIndex + 1, closeBraceIndex).replace(".", "/");
  String functionName = classAndFunction.substring(classAndFunction.lastIndexOf("/") + 1);
  HyperlinkInfo hyperlink = createOpenFileHyperlink(classAndFunction.replace("/" + functionName, ".hx"), lineNumber);
  return new Result(i - s.length() + classAndLineIndex, i - s.length() + openBraceIndex, hyperlink);
}
 
Example #5
Source File: IssueOutputFilter.java    From intellij with Apache License 2.0 6 votes vote down vote up
private Navigatable openConsoleToHyperlink(HyperlinkInfo link, int originalOffset) {
  return new Navigatable() {
    @Override
    public void navigate(boolean requestFocus) {
      BlazeConsoleView consoleView = BlazeConsoleView.getInstance(project);
      ToolWindow toolWindow =
          ToolWindowManager.getInstance(project).getToolWindow(BlazeConsoleToolWindowFactory.ID);
      toolWindow.activate(() -> consoleView.navigateToHyperlink(link, originalOffset), true);
    }

    @Override
    public boolean canNavigate() {
      return true;
    }

    @Override
    public boolean canNavigateToSource() {
      return true;
    }
  };
}
 
Example #6
Source File: BlazeConsoleView.java    From intellij with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #7
Source File: ExtendedRegexFilter.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@Override
public Result applyFilter(String line, int entireLength) {
    Matcher matcher = myPattern.matcher(line);
    if (!matcher.find()) {
        return null;
    }

    String filePath = matcher.group(myFileRegister);
    if (filePath == null) {
        return null;
    }

    String lineNumber = "0";
    if (myLineRegister != -1) {
        lineNumber = matcher.group(myLineRegister);
    }

    String columnNumber = "0";
    if (myColumnRegister != -1) {
        columnNumber = matcher.group(myColumnRegister);
    }

    int line1 = 0;
    int column = 0;
    try {
        line1 = Integer.parseInt(lineNumber);
        column = Integer.parseInt(columnNumber);
    } catch (NumberFormatException e) {
        // Do nothing, so that line and column will remain at their initial zero values.
    }

    if (line1 > 0) line1 -= 1;
    if (column > 0) column -= 1;
    // Calculate the offsets relative to the entire text.
    final int highlightStartOffset = entireLength - line.length() + matcher.start(myFileRegister);
    final int highlightEndOffset = highlightStartOffset + filePath.length();
    final HyperlinkInfo info = createOpenFileHyperlink(filePath, line1, column);
    return new Result(highlightStartOffset, highlightEndOffset, info);
}
 
Example #8
Source File: IssueOutputFilter.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
private static HyperlinkInfo getHyperlinkInfo(IssueOutput issue) {
  Navigatable navigatable = issue.getNavigatable();
  if (navigatable != null) {
    return project -> navigatable.navigate(true);
  }
  VirtualFile vf = resolveVirtualFile(issue.getFile());
  return vf != null
      ? project ->
          new OpenFileDescriptor(project, vf, issue.getLine() - 1, issue.getColumn() - 1)
              .navigate(true)
      : null;
}
 
Example #9
Source File: BlazeConsoleView.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
private RangeHighlighter findRangeForHyperlink(HyperlinkInfo link) {
  Map<RangeHighlighter, HyperlinkInfo> links = consoleView.getHyperlinks().getHyperlinks();
  for (Map.Entry<RangeHighlighter, HyperlinkInfo> entry : links.entrySet()) {
    if (Objects.equals(link, entry.getValue())) {
      return entry.getKey();
    }
  }
  return null;
}
 
Example #10
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void parse(@NotNull String str) {
  if (str.isEmpty()) {
    return;
  }

  final List<Filter.ResultItem> resultItems = new ArrayList<>();
  for (Filter filter : filters) {
    final Filter.Result result = filter.applyFilter(str, str.length());
    if (result == null) {
      continue;
    }
    resultItems.addAll(result.getResultItems());
  }
  resultItems.sort(Comparator.comparingInt(Filter.ResultItem::getHighlightStartOffset));

  int cursor = 0;
  for (Filter.ResultItem item : resultItems) {
    final HyperlinkInfo hyperlinkInfo = item.getHyperlinkInfo();
    if (hyperlinkInfo != null) {
      final int start = item.getHighlightStartOffset();
      final int end = item.getHighlightEndOffset();
      // Leading text.
      if (cursor < start) {
        parseChunk(str.substring(cursor, start));
      }
      write(str.substring(start, end), SimpleTextAttributes.LINK_ATTRIBUTES, hyperlinkInfo);
      cursor = end;
    }
  }

  // Trailing text
  if (cursor < str.length()) {
    parseChunk(str.substring(cursor));
  }
}
 
Example #11
Source File: DataPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
  final Object tag = getTagForPosition(e);
  if (tag instanceof HyperlinkInfo) {
    ((HyperlinkInfo)tag).navigate(project);
  }
}
 
Example #12
Source File: DataPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseMoved(MouseEvent e) {
  final Cursor cursor = getTagForPosition(e) instanceof HyperlinkInfo
                        ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
                        : Cursor.getDefaultCursor();
  tree.setCursor(cursor);
}
 
Example #13
Source File: LineParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void parse(@NotNull String str) {
  if (str.isEmpty()) {
    return;
  }

  final List<Filter.ResultItem> resultItems = new ArrayList<>();
  for (Filter filter : filters) {
    final Filter.Result result = filter.applyFilter(str, str.length());
    if (result == null) {
      continue;
    }
    resultItems.addAll(result.getResultItems());
  }
  resultItems.sort(Comparator.comparingInt(Filter.ResultItem::getHighlightStartOffset));

  int cursor = 0;
  for (Filter.ResultItem item : resultItems) {
    final HyperlinkInfo hyperlinkInfo = item.getHyperlinkInfo();
    if (hyperlinkInfo != null) {
      final int start = item.getHighlightStartOffset();
      final int end = item.getHighlightEndOffset();
      // Leading text.
      if (cursor < start) {
        parseChunk(str.substring(cursor, start));
      }
      write(str.substring(start, end), SimpleTextAttributes.LINK_ATTRIBUTES, hyperlinkInfo);
      cursor = end;
    }
  }

  // Trailing text
  if (cursor < str.length()) {
    parseChunk(str.substring(cursor));
  }
}
 
Example #14
Source File: DataPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseMoved(MouseEvent e) {
  final Cursor cursor = getTagForPosition(e) instanceof HyperlinkInfo
                        ? Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)
                        : Cursor.getDefaultCursor();
  tree.setCursor(cursor);
}
 
Example #15
Source File: IssueOutputFilter.java    From intellij with Apache License 2.0 5 votes vote down vote up
/**
 * A user-visible hyperlink navigating from the console to the relevant file + line of the issue.
 */
@Nullable
private static ResultItem hyperlinkItem(IssueOutput issue, int offset) {
  TextRange range = issue.getConsoleHyperlinkRange();
  HyperlinkInfo link = getHyperlinkInfo(issue);
  if (range == null || link == null) {
    return null;
  }
  return new ResultItem(range.getStartOffset() + offset, range.getEndOffset() + offset, link);
}
 
Example #16
Source File: BlazeCidrTestOutputFilter.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
protected HyperlinkInfo createOpenFileHyperlink(String fileName, int line, int column) {
  HyperlinkInfo result = super.createOpenFileHyperlink(fileName, line, column);
  if (result != null || workspacePathResolver == null) {
    return result;
  }
  File workspaceFile = workspacePathResolver.resolveToFile(fileName);
  return super.createOpenFileHyperlink(workspaceFile.getPath(), line, column);
}
 
Example #17
Source File: AwesomeLinkFilter.java    From intellij-awesome-console with MIT License 5 votes vote down vote up
public List<ResultItem> getResultItemsFile(final String line, final int startPoint) {
	final List<ResultItem> results = new ArrayList<>();
	final HyperlinkInfoFactory hyperlinkInfoFactory = HyperlinkInfoFactory.getInstance();

	final List<FileLinkMatch> matches = detectPaths(line);
	for(final FileLinkMatch match: matches) {
		final String path = PathUtil.getFileName(match.path);
		List<VirtualFile> matchingFiles = fileCache.get(path);

		if (null == matchingFiles) {
			matchingFiles = getResultItemsFileFromBasename(path);
			if (null == matchingFiles || matchingFiles.isEmpty()) {
				continue;
			}
		}

		if (matchingFiles.isEmpty()) {
			continue;
		}

		final List<VirtualFile> bestMatchingFiles = findBestMatchingFiles(match, matchingFiles);
		if (bestMatchingFiles != null && !bestMatchingFiles.isEmpty()) {
			matchingFiles = bestMatchingFiles;
		}
		final HyperlinkInfo linkInfo = hyperlinkInfoFactory.createMultipleFilesHyperlinkInfo(
				matchingFiles,
				match.linkedRow < 0 ? 0 : match.linkedRow - 1,
				project
		);

		results.add(new Result(
				startPoint + match.start,
				startPoint + match.end,
				linkInfo)
		);
	}

	return results;
}
 
Example #18
Source File: DataPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void mouseClicked(MouseEvent e) {
  final Object tag = getTagForPosition(e);
  if (tag instanceof HyperlinkInfo) {
    ((HyperlinkInfo)tag).navigate(project);
  }
}
 
Example #19
Source File: BashLineErrorFilterTest.java    From BashSupport with Apache License 2.0 5 votes vote down vote up
@Test
public void testValidation() throws Exception {
    VirtualFile targetFile = ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
        @Override
        public VirtualFile compute() {
            try {
                VirtualFile srcDir = myFixture.getTempDirFixture().findOrCreateDir("src");
                return srcDir.createChildData(this, "test.sh");
            } catch (IOException e) {
                return null;
            }
        }
    });

    PsiFile targetPsiFile = PsiManager.getInstance(getProject()).findFile(targetFile);
    Assert.assertNotNull(targetPsiFile);
    BashLineErrorFilter filter = new BashLineErrorFilter(getProject());

    String line = String.format("%s: line 13: notHere: command not found", targetFile.getCanonicalPath());
    Filter.Result result = filter.applyFilter(line, line.length());

    Assert.assertNotNull(result);

    HyperlinkInfo hyperlinkInfo = result.getFirstHyperlinkInfo();
    Assert.assertNotNull("Expected a hyperlink on the filename", hyperlinkInfo);

    hyperlinkInfo.navigate(getProject());

    VirtualFile[] openFiles = FileEditorManager.getInstance(getProject()).getOpenFiles();
    Assert.assertEquals("Expected just ony open file", 1, openFiles.length);
    Assert.assertEquals("Expected that navigation opened the target file", targetFile, openFiles[0]);
}
 
Example #20
Source File: ErrorFilter.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
protected HyperlinkInfo createOpenFileHyperlink(String filePath, int line) {
  ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
  List<VirtualFile> roots = rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE);
  VirtualFile virtualFile = null;
  for (VirtualFile testSourceRoot : roots) {
    String fullPath = testSourceRoot.getPath() + "/" + filePath;
    virtualFile = LocalFileSystem.getInstance().findFileByPath(fullPath);
    if(virtualFile != null) {
      break;
    }
  }
  return virtualFile == null ? null : new OpenFileHyperlinkInfo(myModule.getProject(), virtualFile, line - 1);
}
 
Example #21
Source File: ErrorFilterTest.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
private ErrorFilter createFilter() {
  return new ErrorFilter(null){
    @Override
    protected HyperlinkInfo createOpenFileHyperlink(String filePath, int line) {
      return createOpenFile(filePath, line);
    }
  };
}
 
Example #22
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 5 votes vote down vote up
/**
 * @deprecated left for API compatibility
 */
@Deprecated
public Map<RangeHighlighter, HyperlinkInfo> getHyperlinks() {
  LinkedHashMap<RangeHighlighter, HyperlinkInfo> result = new LinkedHashMap<>();
  for (RangeHighlighter highlighter : getHyperlinks(0, myEditor.getDocument().getTextLength(), myEditor)) {
    HyperlinkInfo info = getHyperlinkInfo(highlighter);
    if (info != null) {
      result.put(highlighter, info);
    }
  }
  return result;
}
 
Example #23
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private RangeHighlighter createHyperlink(final int highlightStartOffset,
                                         final int highlightEndOffset,
                                         @Nullable final TextAttributes highlightAttributes,
                                         @Nonnull final HyperlinkInfo hyperlinkInfo,
                                         @Nullable TextAttributes followedHyperlinkAttributes,
                                         int layer) {
  TextAttributes textAttributes = highlightAttributes != null ? highlightAttributes : getHyperlinkAttributes();
  final RangeHighlighter highlighter = myEditor.getMarkupModel().addRangeHighlighter(highlightStartOffset, highlightEndOffset, layer, textAttributes, HighlighterTargetArea.EXACT_RANGE);
  associateHyperlink(highlighter, hyperlinkInfo, followedHyperlinkAttributes);
  return highlighter;
}
 
Example #24
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public HyperlinkInfo getHyperlinkInfoByPoint(final Point p) {
  final LogicalPosition pos = myEditor.xyToLogicalPosition(new Point(p.x, p.y));
  if (EditorUtil.inVirtualSpace(myEditor, pos)) {
    return null;
  }

  return getHyperlinkInfoByLineAndCol(pos.line, pos.column);
}
 
Example #25
Source File: XDebugSessionImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void printMessage(final String message, final String hyperLinkText, @Nullable final HyperlinkInfo info) {
  AppUIUtil.invokeOnEdt(() -> {
    myConsoleView.print(message, ConsoleViewContentType.SYSTEM_OUTPUT);
    if (info != null) {
      myConsoleView.printHyperlink(hyperLinkText, info);
    }
    else if (hyperLinkText != null) {
      myConsoleView.print(hyperLinkText, ConsoleViewContentType.SYSTEM_OUTPUT);
    }
    myConsoleView.print("\n", ConsoleViewContentType.SYSTEM_OUTPUT);
  });
}
 
Example #26
Source File: AnnotateStackTraceAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
//@CalledWithReadLock
private static VirtualFile getHyperlinkVirtualFile(@Nonnull List<RangeHighlighter> links) {
  RangeHighlighter key = ContainerUtil.getLastItem(links);
  if (key == null) return null;
  HyperlinkInfo info = EditorHyperlinkSupport.getHyperlinkInfo(key);
  if (!(info instanceof FileHyperlinkInfo)) return null;
  OpenFileDescriptor descriptor = ((FileHyperlinkInfo)info).getDescriptor();
  return descriptor != null ? descriptor.getFile() : null;
}
 
Example #27
Source File: OutputFileUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public Result applyFilter(String line, int entireLength) {
  if (line.startsWith(CONSOLE_OUTPUT_FILE_MESSAGE)) {
    final String filePath = StringUtil.trimEnd(line.substring(CONSOLE_OUTPUT_FILE_MESSAGE.length()), "\n");

    return new Result(entireLength - filePath.length() - 1, entireLength, new HyperlinkInfo() {
      @Override
      public void navigate(final Project project) {
        final VirtualFile file =
          ApplicationManager.getApplication().runWriteAction(new Computable<VirtualFile>() {
            @Nullable
            @Override
            public VirtualFile compute() {
              return LocalFileSystem.getInstance().refreshAndFindFileByPath(FileUtil.toSystemIndependentName(filePath));
            }
          });

        if (file != null) {
          file.refresh(false, false);
          ApplicationManager.getApplication().runReadAction(new Runnable() {
            @Override
            public void run() {
              FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file), true);
            }
          });
        }
      }
    });
  }
  return null;
}
 
Example #28
Source File: ConsoleLog.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
public static LogEntry formatForLog(@NotNull final Notification notification, String indent) {
    DocumentImpl logDoc = new DocumentImpl("", true);
    AtomicBoolean showMore = new AtomicBoolean(false);
    Map<RangeMarker, HyperlinkInfo> links = new LinkedHashMap<RangeMarker, HyperlinkInfo>();
    List<RangeMarker> lineSeparators = new ArrayList<RangeMarker>();

    String title = truncateLongString(showMore, notification.getTitle());
    String content = truncateLongString(showMore, notification.getContent());

    RangeMarker afterTitle = null;
    boolean hasHtml = parseHtmlContent(title, notification, logDoc, showMore, links, lineSeparators);
    if(StringUtil.isNotEmpty(title)) {
        if(StringUtil.isNotEmpty(content)) {
            appendText(logDoc, ": ");
            afterTitle = logDoc.createRangeMarker(logDoc.getTextLength() - 2, logDoc.getTextLength());
        }
    }
    hasHtml |= parseHtmlContent(content, notification, logDoc, showMore, links, lineSeparators);

    String status = getStatusText(logDoc, showMore, lineSeparators, hasHtml);

    indentNewLines(logDoc, lineSeparators, afterTitle, hasHtml, indent);

    ArrayList<Pair<TextRange, HyperlinkInfo>> list = new ArrayList<Pair<TextRange, HyperlinkInfo>>();
    for(RangeMarker marker : links.keySet()) {
        if(!marker.isValid()) {
            showMore.set(true);
            continue;
        }
        list.add(Pair.create(new TextRange(marker.getStartOffset(), marker.getEndOffset()), links.get(marker)));
    }

    if(showMore.get()) {
        String sb = "show balloon";
        if(!logDoc.getText().endsWith(" ")) {
            appendText(logDoc, " ");
        }
        appendText(logDoc, "(" + sb + ")");
        list.add(new Pair<TextRange, HyperlinkInfo>(TextRange.from(logDoc.getTextLength() - 1 - sb.length(), sb.length()),
            new ShowBalloon(notification)));
    }

    return new LogEntry(logDoc.getText(), status, list);
}
 
Example #29
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public RangeHighlighter createHyperlink(int highlightStartOffset, int highlightEndOffset, @Nullable TextAttributes highlightAttributes, @Nonnull HyperlinkInfo hyperlinkInfo) {
  return createHyperlink(highlightStartOffset, highlightEndOffset, highlightAttributes, hyperlinkInfo, null, HighlighterLayer.HYPERLINK);
}
 
Example #30
Source File: EditorHyperlinkSupport.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static void associateHyperlink(@Nonnull RangeHighlighter highlighter, @Nonnull HyperlinkInfo hyperlinkInfo, @Nullable TextAttributes followedHyperlinkAttributes) {
  highlighter.putUserData(HYPERLINK, new HyperlinkInfoTextAttributes(hyperlinkInfo, followedHyperlinkAttributes));
}