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
public class TextConsoleViewer
extends SourceViewer
implements LineStyleListener, LineBackgroundListener, MouseTrackListener, MouseMoveListener, MouseListener
Default viewer used to display a
TextConsole.
Clients may subclass this class.
- Since:
- 3.1
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jface.text.source.SourceViewer
SourceViewer.RulerLayoutNested classes/interfaces inherited from class org.eclipse.jface.text.TextViewer
TextViewer.TextHoverKey, TextViewer.WidgetCommandNested 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_MODELFields 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_ERRORSFields inherited from class org.eclipse.jface.viewers.Viewer
WIDGET_DATA_KEYFields inherited from interface org.eclipse.jface.text.source.ISourceViewer
CONTENTASSIST_CONTEXT_INFORMATION, CONTENTASSIST_PROPOSALS, FORMAT, INFORMATION, QUICK_ASSISTFields inherited from interface org.eclipse.jface.text.ITextOperationTarget
COPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDOFields inherited from interface org.eclipse.jface.text.ITextViewerExtension2
DEFAULT_HOVER_STATE_MASK -
Constructor Summary
ConstructorsConstructorDescriptionTextConsoleViewer(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
Modifier and TypeMethodDescriptionprotected IDocumentAdapterFactory method to create the document adapter to be used by this viewer.protected CursorReturns the hand cursor.Returns the currently active hyperlink ornullif none.getHyperlink(int offset) Returns the hyperlink at the specified offset, ornullif none.protected CursorReturns the text cursor.protected voidFrees all resources allocated by this viewer.protected voidinternalRevealRange(int start, int end) Reveals the given range of the visible document.voidThis method is called when a line is about to be drawn in order to get its background color.voidlineGetStyle(LineStyleEvent event) This method is called when a line is about to be drawn in order to get the line's style information.protected voidlinkEntered(IHyperlink link) Notification a hyperlink has been entered.protected voidlinkExited(IHyperlink link) Notification a link was exited.voidSent when a mouse button is pressed twice within the (operating system specified) double click period.voidSent when a mouse button is pressed.voidSent when the mouse pointer passes into the area of the screen covered by a control.voidSent when the mouse pointer passes out of the area of the screen covered by a control.voidSent when the mouse pointer hovers (that is, stops moving for an (operating system specified) period of time) over a control.voidSent when the mouse moves.voidSent when a mouse button is released.protected voidPositions the cursor at the end of the document.voidsetConsoleAutoScrollLock(boolean autoScrollLock) Sets the user preference for console auto scroll lock.voidsetConsoleWidth(int width) Sets the console to have a fixed character width.voidSets the font used by this viewer.voidsetTabWidth(int tabWidth) Sets the tab width used by this viewer.protected voidupdateLinks(int offset) The cursor has just be moved to the given offset, the mouse has hovered over the given offset.protected voidInforms 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, updateSlaveDocumentsMethods 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, widgetSelection2ModelSelectionMethods inherited from class org.eclipse.jface.viewers.Viewer
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelectionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelectionMethods 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 Details
-
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
Constructs a new viewer in the given parent for the specified console.- Parameters:
parent- containing widgetconsole- text console
-
-
Method Details
-
setTabWidth
public void setTabWidth(int tabWidth) Sets the tab width used by this viewer.- Parameters:
tabWidth- the tab width used by this viewer
-
setFont
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
Description copied from interface:LineStyleListenerThis 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:
lineGetStylein interfaceLineStyleListener- Parameters:
event- the given event- See Also:
-
lineGetBackground
Description copied from interface:LineBackgroundListenerThis 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:
lineGetBackgroundin interfaceLineBackgroundListener- Parameters:
event- the given event- See Also:
-
getHandCursor
Returns the hand cursor.- Returns:
- the hand cursor
-
getTextCursor
Returns the text cursor.- Returns:
- the text cursor
-
linkEntered
Notification a hyperlink has been entered.- Parameters:
link- the link that was entered
-
linkExited
Notification a link was exited.- Parameters:
link- the link that was exited
-
mouseEnter
Description copied from interface:MouseTrackListenerSent when the mouse pointer passes into the area of the screen covered by a control.- Specified by:
mouseEnterin interfaceMouseTrackListener- Parameters:
e- an event containing information about the mouse enter
-
mouseExit
Description copied from interface:MouseTrackListenerSent when the mouse pointer passes out of the area of the screen covered by a control.- Specified by:
mouseExitin interfaceMouseTrackListener- Parameters:
e- an event containing information about the mouse exit
-
mouseHover
Description copied from interface:MouseTrackListenerSent when the mouse pointer hovers (that is, stops moving for an (operating system specified) period of time) over a control.- Specified by:
mouseHoverin interfaceMouseTrackListener- Parameters:
e- an event containing information about the hover
-
mouseMove
Description copied from interface:MouseMoveListenerSent when the mouse moves.- Specified by:
mouseMovein 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
Returns the currently active hyperlink ornullif none.- Returns:
- the currently active hyperlink or
nullif none
-
getHyperlink
Returns the hyperlink at the specified offset, ornullif none.- Parameters:
offset- offset at which a hyperlink has been requested- Returns:
- hyperlink at the specified offset, or
nullif none
-
mouseDoubleClick
Description copied from interface:MouseListenerSent when a mouse button is pressed twice within the (operating system specified) double click period.- Specified by:
mouseDoubleClickin interfaceMouseListener- Parameters:
e- an event containing information about the mouse double click- See Also:
-
mouseDown
Description copied from interface:MouseListenerSent when a mouse button is pressed.- Specified by:
mouseDownin interfaceMouseListener- Parameters:
e- an event containing information about the mouse button press
-
mouseUp
Description copied from interface:MouseListenerSent when a mouse button is released.- Specified by:
mouseUpin interfaceMouseListener- Parameters:
e- an event containing information about the mouse button release
-
createDocumentAdapter
Description copied from class:TextViewerFactory method to create the document adapter to be used by this viewer.- Overrides:
createDocumentAdapterin 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:TextViewerFrees all resources allocated by this viewer. Internally called when the viewer's control has been disposed.- Overrides:
handleDisposein classSourceViewer
-
updateTextListeners
Description copied from class:TextViewerInforms all registered text listeners about the change specified by the widget command. This method does not use a robust iterator.- Overrides:
updateTextListenersin 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:TextViewerReveals the given range of the visible document.- Overrides:
internalRevealRangein classTextViewer- Parameters:
start- the start offset of the rangeend- the end offset of the range
-