Class HyperlinkManager

    • Method Detail

      • install

        public void install​(ITextViewer textViewer,
                            IHyperlinkPresenter hyperlinkPresenter,
                            IHyperlinkDetector[] hyperlinkDetectors,
                            int eventStateMask)
        Installs this hyperlink manager with the given arguments.
        Parameters:
        textViewer - the text viewer
        hyperlinkPresenter - the hyperlink presenter
        hyperlinkDetectors - the array of hyperlink detectors, must not be empty
        eventStateMask - the SWT event state mask to activate hyperlink mode
      • setHyperlinkDetectors

        public void setHyperlinkDetectors​(IHyperlinkDetector[] hyperlinkDetectors)
        Sets the hyperlink detectors for this hyperlink manager.

        It is allowed to call this method after this hyperlink manger has been installed.

        Parameters:
        hyperlinkDetectors - and array of hyperlink detectors, must not be empty
      • setHyperlinkStateMask

        public void setHyperlinkStateMask​(int eventStateMask)
        Sets the SWT event state mask which in combination with the left mouse button triggers the hyperlink mode.

        It is allowed to call this method after this hyperlink manger has been installed.

        Note that IHyperlinkDetectorExtension2s may specify additional state masks.

        Parameters:
        eventStateMask - the SWT event state mask to activate hyperlink mode
      • uninstall

        public void uninstall()
        Uninstalls this hyperlink manager.
      • deactivate

        protected void deactivate()
        Deactivates the currently shown hyperlinks.
      • findHyperlinks

        protected IHyperlink[] findHyperlinks()
        Finds hyperlinks at the current offset.
        Returns:
        the hyperlinks or null if none.
      • computeLongestHyperlinkLength

        protected int computeLongestHyperlinkLength​(List<? extends IHyperlink> hyperlinks)
        Computes the length of the longest detected hyperlink.
        Parameters:
        hyperlinks - the list of hyperlinks
        Returns:
        the length of the longest detected
      • getCurrentTextOffset

        protected int getCurrentTextOffset()
        Returns the offset in the given viewer that corresponds to the current cursor location.
        Returns:
        the offset in the given viewer that corresponds to the current cursor location.
      • keyPressed

        public void keyPressed​(KeyEvent event)
        Description copied from interface: KeyListener
        Sent when a key is pressed on the system keyboard.
        Specified by:
        keyPressed in interface KeyListener
        Parameters:
        event - an event containing information about the key press
      • keyReleased

        public void keyReleased​(KeyEvent event)
        Description copied from interface: KeyListener
        Sent when a key is released on the system keyboard.
        Specified by:
        keyReleased in interface KeyListener
        Parameters:
        event - an event containing information about the key release
      • mouseDown

        public void mouseDown​(MouseEvent event)
        Description copied from interface: MouseListener
        Sent when a mouse button is pressed.
        Specified by:
        mouseDown in interface MouseListener
        Parameters:
        event - an event containing information about the mouse button press
      • mouseUp

        public void mouseUp​(MouseEvent e)
        Description copied from interface: MouseListener
        Sent when a mouse button is released.
        Specified by:
        mouseUp in interface MouseListener
        Parameters:
        e - an event containing information about the mouse button release
      • mouseMove

        public void mouseMove​(MouseEvent event)
        Description copied from interface: MouseMoveListener
        Sent when the mouse moves.
        Specified by:
        mouseMove in interface MouseMoveListener
        Parameters:
        event - an event containing information about the mouse move
      • focusGained

        public void focusGained​(FocusEvent e)
        Description copied from interface: FocusListener
        Sent when a control gets focus.
        Specified by:
        focusGained in interface FocusListener
        Parameters:
        e - an event containing information about the focus change
      • focusLost

        public void focusLost​(FocusEvent event)
        Description copied from interface: FocusListener
        Sent when a control loses focus.
        Specified by:
        focusLost in interface FocusListener
        Parameters:
        event - an event containing information about the focus change
      • handleEvent

        public void handleEvent​(Event event)
        Description copied from interface: Listener
        Sent when an event that the receiver has registered for occurs.
        Specified by:
        handleEvent in interface Listener
        Parameters:
        event - the event which occurred
      • textChanged

        public void textChanged​(TextEvent event)
        Description copied from interface: ITextListener
        The visual representation of a text viewer this listener is registered with has been changed.
        Specified by:
        textChanged in interface ITextListener
        Parameters:
        event - the description of the change
      • mouseExit

        public void mouseExit​(MouseEvent e)
        Sent when the mouse pointer passes out of the area of the screen covered by a control.
        Specified by:
        mouseExit in interface MouseTrackListener
        Parameters:
        e - an event containing information about the mouse exit
        Since:
        3.4
      • mouseEnter

        public void mouseEnter​(MouseEvent e)
        Sent when the mouse pointer passes into the area of the screen covered by a control.
        Specified by:
        mouseEnter in interface MouseTrackListener
        Parameters:
        e - an event containing information about the mouse enter
        Since:
        3.4
      • mouseHover

        public void mouseHover​(MouseEvent e)
        Sent when the mouse pointer hovers (that is, stops moving for an (operating system specified) period of time) over a control.
        Specified by:
        mouseHover in interface MouseTrackListener
        Parameters:
        e - an event containing information about the hover
        Since:
        3.4
      • openHyperlink

        public boolean openHyperlink()
        Opens the hyperlink at the caret location or opens a chooser if more than one hyperlink is available.
        Returns:
        true if at least one hyperlink has been found at the caret location, false otherwise
        Since:
        3.6
        See Also:
        OPEN_HYPERLINK