Package org.eclipse.ui.console
Class TextConsoleViewer
- java.lang.Object
-
- org.eclipse.jface.viewers.Viewer
-
- org.eclipse.jface.text.TextViewer
-
- org.eclipse.jface.text.source.SourceViewer
-
- org.eclipse.ui.console.TextConsoleViewer
-
- All Implemented Interfaces:
EventListener
,IEditingSupportRegistry
,ITextOperationTarget
,ITextOperationTargetExtension
,ITextViewer
,ITextViewerExtension
,ITextViewerExtension2
,ITextViewerExtension4
,ITextViewerExtension6
,ITextViewerExtension7
,ITextViewerExtension8
,ITextViewerExtension9
,IWidgetTokenOwner
,IWidgetTokenOwnerExtension
,ISourceViewer
,ISourceViewerExtension
,ISourceViewerExtension2
,ISourceViewerExtension3
,ISourceViewerExtension4
,ISourceViewerExtension5
,IInputProvider
,IInputSelectionProvider
,IPostSelectionProvider
,ISelectionProvider
,LineBackgroundListener
,LineStyleListener
,MouseListener
,MouseMoveListener
,MouseTrackListener
,SWTEventListener
public class TextConsoleViewer extends SourceViewer implements LineStyleListener, LineBackgroundListener, MouseTrackListener, MouseMoveListener, MouseListener
Default viewer used to display aTextConsole
.Clients may subclass this class.
- Since:
- 3.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jface.text.source.SourceViewer
SourceViewer.RulerLayout
-
Nested classes/interfaces inherited from class org.eclipse.jface.text.TextViewer
TextViewer.TextHoverKey, TextViewer.WidgetCommand
-
Nested classes/interfaces inherited from interface org.eclipse.jface.text.ITextViewerExtension8
ITextViewerExtension8.EnrichMode
-
-
Field Summary
-
Fields inherited from class org.eclipse.jface.text.source.SourceViewer
_SELECTION_POSITION_CATEGORY, fAnnotationHover, fContentAssistant, fContentAssistantInstalled, fContentFormatter, fInformationPresenter, fOverviewRulerAnnotationHover, fPresentationReconciler, fQuickAssistAssistant, fQuickAssistAssistantInstalled, fReconciler, fSelectionCategory, fSelections, fSelectionUpdater, GAP_SIZE, GAP_SIZE_1, MODEL_ANNOTATION_MODEL
-
Fields inherited from class org.eclipse.jface.text.TextViewer
fAutoIndentStrategies, fDefaultPrefixChars, fDoubleClickStrategies, fEventConsumer, fFindReplaceDocumentAdapter, fHoverControlCreator, fHyperlinkDetectors, fHyperlinkManager, fHyperlinkPresenter, fHyperlinkStateMask, fIgnoreAutoIndent, fIndentChars, fInformationMapping, fLastTopPixel, fMarkPosition, fPaintManager, fPartitioning, fReplaceTextPresentation, fTextHovers, fTextInputListeners, fTextListeners, fTextPresentationListeners, fUndoManager, fViewportListeners, INTERNAL, KEY, MOUSE, MOUSE_END, RESIZE, SCROLLER, SHIFTING, TRACE_ERRORS
-
Fields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEY
-
Fields inherited from interface org.eclipse.jface.text.source.ISourceViewer
CONTENTASSIST_CONTEXT_INFORMATION, CONTENTASSIST_PROPOSALS, FORMAT, INFORMATION, QUICK_ASSIST
-
Fields inherited from interface org.eclipse.jface.text.ITextOperationTarget
COPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDO
-
Fields inherited from interface org.eclipse.jface.text.ITextViewerExtension2
DEFAULT_HOVER_STATE_MASK
-
-
Constructor Summary
Constructors Constructor Description TextConsoleViewer(Composite parent, TextConsole console)
Constructs a new viewer in the given parent for the specified console.TextConsoleViewer(Composite parent, TextConsole console, IScrollLockStateProvider scrollLockStateProvider)
Constructs a new viewer in the given parent for the specified console.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected IDocumentAdapter
createDocumentAdapter()
Factory method to create the document adapter to be used by this viewer.protected Cursor
getHandCursor()
Returns the hand cursor.IHyperlink
getHyperlink()
Returns the currently active hyperlink ornull
if none.IHyperlink
getHyperlink(int offset)
Returns the hyperlink at the specified offset, ornull
if none.protected Cursor
getTextCursor()
Returns the text cursor.protected void
handleDispose()
Frees all resources allocated by this viewer.protected void
internalRevealRange(int start, int end)
Reveals the given range of the visible document.void
lineGetBackground(LineBackgroundEvent event)
This method is called when a line is about to be drawn in order to get its background color.void
lineGetStyle(LineStyleEvent event)
This method is called when a line is about to be drawn in order to get the line's style information.protected void
linkEntered(IHyperlink link)
Notification a hyperlink has been entered.protected void
linkExited(IHyperlink link)
Notification a link was exited.void
mouseDoubleClick(MouseEvent e)
Sent when a mouse button is pressed twice within the (operating system specified) double click period.void
mouseDown(MouseEvent e)
Sent when a mouse button is pressed.void
mouseEnter(MouseEvent e)
Sent when the mouse pointer passes into the area of the screen covered by a control.void
mouseExit(MouseEvent e)
Sent when the mouse pointer passes out of the area of the screen covered by a control.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.void
mouseMove(MouseEvent e)
Sent when the mouse moves.void
mouseUp(MouseEvent e)
Sent when a mouse button is released.protected void
revealEndOfDocument()
Positions the cursor at the end of the document.void
setConsoleAutoScrollLock(boolean autoScrollLock)
Sets the user preference for console auto scroll lock.void
setConsoleWidth(int width)
Sets the console to have a fixed character width.void
setFont(Font font)
Sets the font used by this viewer.void
setTabWidth(int tabWidth)
Sets the tab width used by this viewer.protected void
updateLinks(int offset)
The cursor has just be moved to the given offset, the mouse has hovered over the given offset.protected void
updateTextListeners(TextViewer.WidgetCommand cmd)
Informs all registered text listeners about the change specified by the widget command.-
Methods inherited from class org.eclipse.jface.text.source.SourceViewer
activatePlugins, addVerticalRulerColumn, canDoOperation, clearRememberedSelection, configure, createControl, createFormattingContext, createFormattingContext, createLayout, createVisualAnnotationModel, disposeVisualAnnotationModel, doOperation, enableOperation, ensureAnnotationHoverManagerInstalled, ensureOverviewHoverManagerInstalled, getAnnotationModel, getContentAssistantFacade, getControl, getCurrentAnnotationHover, getQuickAssistAssistant, getQuickAssistInvocationContext, getRangeIndication, getVerticalRuler, getVisualAnnotationModel, hasCodeMiningProviders, rememberSelection, removeRangeIndication, removeVerticalRulerColumn, restoreSelection, setAnnotationHover, setCodeMiningAnnotationPainter, setCodeMiningProviders, setDocument, setDocument, setDocument, setDocument, setHoverEnrichMode, setOverviewRulerAnnotationHover, setRangeIndication, setRangeIndicator, showAnnotations, showAnnotationsOverview, unconfigure, updateCodeMinings, updateSlaveDocuments
-
Methods inherited from class org.eclipse.jface.text.TextViewer
_getVisibleRegionOffset, _internalGetVisibleRegion, addPainter, addPostSelectionChangedListener, addTextInputListener, addTextListener, addTextPresentationListener, addViewportListener, appendVerifyKeyListener, areMultipleLinesSelected, canPerformFind, changeTextPresentation, copyMarkedRegion, createSlaveDocument, createSlaveDocumentManager, createTextWidget, customizeDocumentCommand, deleteText, disableRedrawing, enabledRedrawing, enabledRedrawing, event2ModelRange, findAndSelect, findAndSelect, findAndSelectInRange, fireInputDocumentAboutToBeChanged, fireInputDocumentChanged, firePostSelectionChanged, fireSelectionChanged, freeSlaveDocument, getAverageCharWidth, getBottomIndex, getBottomIndexEndOffset, getClosestWidgetLineForModelLine, getCurrentTextHover, getDocument, getDocumentPartitioning, getEmptySelectionChangedEventDelay, getExtent, getFindReplaceDocumentAdapter, getFindReplaceTarget, getHoverEventLocation, getInput, getLastKnownSelection, getMark, getModelCoverage, getPaintManager, getRegisteredSupports, getRewriteTarget, getSelectedRange, getSelection, getSelectionProvider, getSlaveDocumentManager, getTextHover, getTextHover, getTextHoveringController, getTextOperationTarget, getTextWidget, getTopIndex, getTopIndexStartOffset, getTopInset, getUndoManager, getVisibleDocument, getVisibleLinesInViewport, getVisibleRegion, getWidthInPixels, getWidthInPixels, handleVerifyEvent, handleVisibleDocumentAboutToBeChanged, handleVisibleDocumentChanged, ignoreAutoEditStrategies, initializeDocumentInformationMapping, inputChanged, invalidateTextPresentation, invalidateTextPresentation, isBlockSelected, isEditable, isIgnoringAutoEditStrategies, isPrintable, markChanged, modelLine2WidgetLine, modelOffset2WidgetOffset, modelRange2ClosestWidgetRange, modelRange2WidgetRange, modelRange2WidgetRange, modelSelection2WidgetSelection, modelStyleRange2WidgetStyleRange, moveFocusToWidgetToken, overlapsWithVisibleRegion, prependAutoEditStrategy, prependVerifyKeyListener, print, print, redraws, refresh, register, releaseWidgetToken, removeAutoEditStrategy, removePainter, removePostSelectionChangedListener, removeTextHovers, removeTextInputListener, removeTextListener, removeTextPresentationListener, removeVerifyKeyListener, removeViewportListener, requestWidgetToken, requestWidgetToken, resetPlugins, resetVisibleRegion, revealRange, selectContentTypePlugin, selectionChanged, setAutoEditStrategies, setAutoIndentStrategy, setDefaultPrefixes, setDocumentPartitioning, setEditable, setEventConsumer, setHoverControlCreator, setHyperlinkDetectors, setHyperlinkPresenter, setIndentPrefixes, setInput, setMark, setRedraw, setRedraw, setSelectedRange, setSelection, setTabsToSpacesConverter, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTextHover, setTopIndex, setUndoManager, setVisibleDocument, setVisibleRegion, shift, shift, startSequentialRewriteMode, stopSequentialRewriteMode, unregister, updateSlaveDocument, updateViewportListeners, updateVisibleDocument, validateSelectionRange, widgetLine2ModelLine, widgetLineOfWidgetOffset, widgetlLine2ModelLine, widgetOffset2ModelOffset, widgetRange2ModelRange, widgetSelection2ModelSelection
-
Methods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
-
Methods inherited from interface org.eclipse.jface.text.ITextViewer
addTextInputListener, addTextListener, addViewportListener, changeTextPresentation, getBottomIndex, getBottomIndexEndOffset, getDocument, getFindReplaceTarget, getSelectedRange, getSelectionProvider, getTextOperationTarget, getTextWidget, getTopIndex, getTopIndexStartOffset, getTopInset, getVisibleRegion, invalidateTextPresentation, isEditable, overlapsWithVisibleRegion, removeTextInputListener, removeTextListener, removeViewportListener, resetPlugins, resetVisibleRegion, revealRange, setAutoIndentStrategy, setDefaultPrefixes, setEditable, setEventConsumer, setIndentPrefixes, setSelectedRange, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTopIndex, setUndoManager, setVisibleRegion
-
-
-
-
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 compositeconsole
- the text consolescrollLockStateProvider
- 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 widgetconsole
- 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 interfaceLineStyleListener
- 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 interfaceLineBackgroundListener
- 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 interfaceMouseTrackListener
- 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 interfaceMouseTrackListener
- 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 interfaceMouseTrackListener
- Parameters:
e
- an event containing information about the hover
-
mouseMove
public void mouseMove(MouseEvent e)
Description copied from interface:MouseMoveListener
Sent when the mouse moves.- Specified by:
mouseMove
in interfaceMouseMoveListener
- Parameters:
e
- an event containing information about the mouse move
-
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 ornull
if none.- Returns:
- the currently active hyperlink or
null
if none
-
getHyperlink
public IHyperlink getHyperlink(int offset)
Returns the hyperlink at the specified offset, ornull
if none.- Parameters:
offset
- offset at which a hyperlink has been requested- Returns:
- hyperlink at the specified offset, or
null
if none
-
mouseDoubleClick
public void mouseDoubleClick(MouseEvent e)
Description copied from interface:MouseListener
Sent when a mouse button is pressed twice within the (operating system specified) double click period.- Specified by:
mouseDoubleClick
in interfaceMouseListener
- Parameters:
e
- an event containing information about the mouse double click- See Also:
Display.getDoubleClickTime()
-
mouseDown
public void mouseDown(MouseEvent e)
Description copied from interface:MouseListener
Sent when a mouse button is pressed.- Specified by:
mouseDown
in interfaceMouseListener
- 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 interfaceMouseListener
- 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 classTextViewer
- 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 classSourceViewer
-
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 classTextViewer
- 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 classTextViewer
- Parameters:
start
- the start offset of the rangeend
- the end offset of the range
-
-