Interface IHyperlinkDetector

  • All Known Implementing Classes:
    AbstractHyperlinkDetector, URLHyperlinkDetector
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface IHyperlinkDetector
    A hyperlink detector tries to find a hyperlink at a given location in a given text viewer.

    In order to provide backward compatibility for clients of IHyperlinkDetector, extension interfaces are used to provide a means of evolution. The following extension interfaces exist:

    Clients may implement this interface.

    Since:
    3.1
    See Also:
    SourceViewerConfiguration.getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
    • Method Detail

      • detectHyperlinks

        IHyperlink[] detectHyperlinks​(ITextViewer textViewer,
                                      IRegion region,
                                      boolean canShowMultipleHyperlinks)
        Tries to detect hyperlinks for the given region in the given text viewer and returns them.

        In most of the cases only one hyperlink should be returned.

        Parameters:
        textViewer - the text viewer on which the hover popup should be shown
        region - the text range in the text viewer which is used to detect the hyperlinks
        canShowMultipleHyperlinks - tells whether the caller is able to show multiple links to the user. If true IHyperlink.open() should directly open the link and not show any additional UI to select from a list. If false this method should only return one hyperlink which upon IHyperlink.open() may allow to select from a list.
        Returns:
        the hyperlinks or null if no hyperlink was detected