Class TextConsoleViewer

    • Constructor Detail

      • TextConsoleViewer

        public TextConsoleViewer​(Composite parent,
                                 TextConsole console,
                                 IScrollLockStateProvider scrollLockStateProvider)
        Constructs a new viewer in the given parent for the specified console.
        Parameters:
        parent - the containing composite
        console - the text console
        scrollLockStateProvider - the scroll lock state provider
        Since:
        3.6
      • TextConsoleViewer

        public TextConsoleViewer​(Composite parent,
                                 TextConsole console)
        Constructs a new viewer in the given parent for the specified console.
        Parameters:
        parent - containing widget
        console - text console
    • Method Detail

      • setTabWidth

        public void setTabWidth​(int tabWidth)
        Sets the tab width used by this viewer.
        Parameters:
        tabWidth - the tab width used by this viewer
      • setFont

        public void setFont​(Font font)
        Sets the font used by this viewer.
        Parameters:
        font - the font used by this viewer
      • revealEndOfDocument

        protected void revealEndOfDocument()
        Positions the cursor at the end of the document.
      • lineGetStyle

        public void lineGetStyle​(LineStyleEvent event)
        Description copied from interface: LineStyleListener
        This method is called when a line is about to be drawn in order to get the line's style information.

        The following event fields are used:

        • event.lineOffset line start offset (input)
        • event.lineText line text (input)
        • event.styles array of StyleRanges, need to be in order (output)
        Specified by:
        lineGetStyle in interface LineStyleListener
        Parameters:
        event - the given event
        See Also:
        LineStyleEvent
      • lineGetBackground

        public void lineGetBackground​(LineBackgroundEvent event)
        Description copied from interface: LineBackgroundListener
        This method is called when a line is about to be drawn in order to get its background color.

        The following event fields are used:

        • event.lineOffset line start offset (input)
        • event.lineText line text (input)
        • event.lineBackground line background color (output)
        Specified by:
        lineGetBackground in interface LineBackgroundListener
        Parameters:
        event - the given event
        See Also:
        LineBackgroundEvent
      • getHandCursor

        protected Cursor getHandCursor()
        Returns the hand cursor.
        Returns:
        the hand cursor
      • getTextCursor

        protected Cursor getTextCursor()
        Returns the text cursor.
        Returns:
        the text cursor
      • linkEntered

        protected void linkEntered​(IHyperlink link)
        Notification a hyperlink has been entered.
        Parameters:
        link - the link that was entered
      • linkExited

        protected void linkExited​(IHyperlink link)
        Notification a link was exited.
        Parameters:
        link - the link that was exited
      • mouseEnter

        public void mouseEnter​(MouseEvent e)
        Description copied from interface: MouseTrackListener
        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
      • mouseExit

        public void mouseExit​(MouseEvent e)
        Description copied from interface: MouseTrackListener
        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
      • mouseHover

        public void mouseHover​(MouseEvent e)
        Description copied from interface: MouseTrackListener
        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
      • updateLinks

        protected void updateLinks​(int offset)
        The cursor has just be moved to the given offset, the mouse has hovered over the given offset. Update link rendering.
        Parameters:
        offset - The offset cursor has been moved to.
      • getHyperlink

        public IHyperlink getHyperlink()
        Returns the currently active hyperlink or null if none.
        Returns:
        the currently active hyperlink or null if none
      • getHyperlink

        public IHyperlink getHyperlink​(int offset)
        Returns the hyperlink at the specified offset, or null if none.
        Parameters:
        offset - offset at which a hyperlink has been requested
        Returns:
        hyperlink at the specified offset, or null if none
      • mouseDown

        public void mouseDown​(MouseEvent e)
        Description copied from interface: MouseListener
        Sent when a mouse button is pressed.
        Specified by:
        mouseDown in interface MouseListener
        Parameters:
        e - 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
      • createDocumentAdapter

        protected IDocumentAdapter createDocumentAdapter()
        Description copied from class: TextViewer
        Factory method to create the document adapter to be used by this viewer.
        Overrides:
        createDocumentAdapter in class TextViewer
        Returns:
        the document adapter to be used
      • setConsoleAutoScrollLock

        public void setConsoleAutoScrollLock​(boolean autoScrollLock)
        Sets the user preference for console auto scroll lock.
        Parameters:
        autoScrollLock - user preference for console auto scroll lock
        Since:
        3.8
      • setConsoleWidth

        public void setConsoleWidth​(int width)
        Sets the console to have a fixed character width. Use -1 to indicate that a fixed width should not be used.
        Parameters:
        width - fixed character width of the console, or -1
      • handleDispose

        protected void handleDispose()
        Description copied from class: TextViewer
        Frees all resources allocated by this viewer. Internally called when the viewer's control has been disposed.
        Overrides:
        handleDispose in class SourceViewer
      • updateTextListeners

        protected void updateTextListeners​(TextViewer.WidgetCommand cmd)
        Description copied from class: TextViewer
        Informs all registered text listeners about the change specified by the widget command. This method does not use a robust iterator.
        Overrides:
        updateTextListeners in class TextViewer
        Parameters:
        cmd - the widget command translated into a text event sent to all text listeners
      • internalRevealRange

        protected void internalRevealRange​(int start,
                                           int end)
        Description copied from class: TextViewer
        Reveals the given range of the visible document.
        Overrides:
        internalRevealRange in class TextViewer
        Parameters:
        start - the start offset of the range
        end - the end offset of the range