Class TextViewer
- All Implemented Interfaces:
- IEditingSupportRegistry,- ITextOperationTarget,- ITextOperationTargetExtension,- ITextViewer,- ITextViewerExtension,- ITextViewerExtension2,- ITextViewerExtension4,- ITextViewerExtension6,- ITextViewerExtension7,- ITextViewerExtension8,- ITextViewerExtension9,- IWidgetTokenOwner,- IWidgetTokenOwnerExtension,- IInputProvider,- IInputSelectionProvider,- IPostSelectionProvider,- ISelectionProvider
- Direct Known Subclasses:
- SourceViewer
ITextViewer and its extension interfaces.
 Once the viewer and its SWT control have been created the viewer can only
 indirectly be disposed by disposing its SWT control.
 
 Clients are supposed to instantiate a text viewer and subsequently to
 communicate with it exclusively using the
 ITextViewer interface or any of the
 implemented extension interfaces.
 
 A text viewer serves as text operation target. It only partially supports the
 external control of the enable state of its text operations. A text viewer is
 also a widget token owner. Anything that wants to display an overlay window
 on top of a text viewer should implement the
 IWidgetTokenKeeper interface and participate
 in the widget token negotiation between the text viewer and all its potential
 widget token keepers.
 
This class is not intended to be subclassed outside the JFace Text component.
- Restriction:
- This class is not intended to be subclassed by clients.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected classValue object used as key in the text hover configuration table.protected classRepresents a replace command that brings the text viewer's text widget back in synchronization with text viewer's document after the document has been changed.Nested classes/interfaces inherited from interface org.eclipse.jface.text.ITextViewerExtension8ITextViewerExtension8.EnrichMode
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Map<String, List<IAutoEditStrategy>> The text viewer's auto indent strategiesThe string a line is prefixed with on PREFIX and removed from each line on STRIP_PREFIXprotected Map<String, ITextDoubleClickStrategy> The text viewer's text double click strategiesprotected IEventConsumerThe text viewer's event consumerprotected FindReplaceDocumentAdapterThe find/replace document adapter.protected IInformationControlCreatorThe creator of the text hover controlprotected IHyperlinkDetector[]The text viewer's hyperlink detectors.protected HyperlinkManagerThe text viewer's hyperlink manager.protected IHyperlinkPresenterThe text viewer's hyperlink presenter.protected intThe SWT key modifier mask which in combination with the left mouse button triggers the hyperlink mode.protected booleanShould the auto indent strategies ignore the next edit operationThe strings a line is prefixed with on SHIFT_RIGHT and removed from each line on SHIFT_LEFTprotected IDocumentInformationMappingThe mapping between model and visible document.protected intThe last visible vertical position of the top lineprotected PositionThe mark position.protected PaintManagerThe viewer's paint manager.protected StringThe viewers partitioning.protected booleanIndicates whether the viewer's text presentation should be replaced are modified.protected Map<TextViewer.TextHoverKey, ITextHover> The text viewer's text hoversprotected List<ITextInputListener> All registered text input listenersprotected List<ITextListener> All registered text listenersprotected List<ITextPresentationListener> All registered text presentation listeners.protected IUndoManagerThe text viewer's undo managerprotected List<IViewportListener> All registered view port listenersprotected static final intIdentifies internal reasons as originators of a view port change.protected static final intIdentifies key strokes as originators of a view port change.protected static final intIdentifies mouse moves as originators of a view port change.protected static final intIdentifies mouse button up as originator of a view port change.protected static final intIdentifies window resizing as originator of a view port change.protected static final intIdentifies the scrollbars as originators of a view port change.protected static final StringInternal name of the position category used selection preservation during shift.static final booleanInternal flag to indicate the debug state.Fields inherited from class org.eclipse.jface.viewers.ViewerWIDGET_DATA_KEYFields inherited from interface org.eclipse.jface.text.ITextOperationTargetCOPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDOFields inherited from interface org.eclipse.jface.text.ITextViewerExtension2DEFAULT_HOVER_STATE_MASK
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedInternal use onlyTextViewer(Composite parent, int styles) Create a new text viewer with the given SWT style bits.
- 
Method SummaryModifier and TypeMethodDescriptionprotected intReturns the offset of the visible region.protected IRegionReturns the visible region if it is not equal to the whole document.voidActivates the installed plug-ins.voidaddPainter(IPainter painter) Adds the given painter to this viewer.voidAdds a listener for post selection changes in this selection provider.voidaddTextInputListener(ITextInputListener listener) Adds a text input listener to this viewer.voidaddTextListener(ITextListener listener) Adds a text listener to this viewer.voidAdds the given text presentation listener to this text viewer.voidaddViewportListener(IViewportListener listener) Adds the given view port listener to this viewer.voidappendVerifyKeyListener(VerifyKeyListener listener) Appends a verify key listener to the viewer's list of verify key listeners.protected booleanReturnstrueif one line is completely selected or if multiple lines are selected.booleancanDoOperation(int operation) Returns whether the operation specified by the given operation code can be performed.protected booleanAdheres to the contract ofIFindReplaceTarget.canPerformFind().voidchangeTextPresentation(TextPresentation presentation, boolean controlRedraw) Applies the color information encoded in the given text presentation.protected voidcopyMarkedRegion(boolean delete) Copies/cuts the marked region.protected voidcreateControl(Composite parent, int styles) Creates the viewer's SWT control.protected IDocumentAdapterFactory method to create the document adapter to be used by this viewer.protected IDocumentcreateSlaveDocument(IDocument document) Creates a slave document for the given document if there is a slave document manager associated with this viewer.protected ISlaveDocumentManagerCreates a new slave document manager.protected StyledTextcreateTextWidget(Composite parent, int styles) Factory method to create the text widget to be used as the viewer's text widget.protected voidcustomizeDocumentCommand(DocumentCommand command) Hook called on receipt of aVerifyEvent.protected voidDeprecated.protected voidDisables the redrawing of this text viewer.voiddoOperation(int operation) Performs the operation specified by the operation code on the target.protected voidEnables the redrawing of this text viewer.protected voidenabledRedrawing(int topIndex) Enables the redrawing of this text viewer.voidenableOperation(int operation, boolean enable) Enables/disabled the given text operation.protected IRegionevent2ModelRange(VerifyEvent event) Translates the widget region of the given verify event into the corresponding region of the viewer's document.protected intfindAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) Deprecated.protected intfindAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) Adheres to the contract ofIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).protected intfindAndSelectInRange(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, int rangeOffset, int rangeLength, boolean regExSearch) Adheres to the contract ofIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).protected voidfireInputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) Informs all registered text input listeners about the forthcoming input change, This method does not use a robust iterator.protected voidfireInputDocumentChanged(IDocument oldInput, IDocument newInput) Informs all registered text input listeners about the successful input change, This method does not use a robust iterator.protected voidfirePostSelectionChanged(int offset, int length) Sends out a text selection changed event to all registered post selection changed listeners.protected voidfireSelectionChanged(int offset, int length) Sends out a text selection changed event to all registered listeners.protected voidfreeSlaveDocument(IDocument slave) Frees the given document if it is a slave document.protected final intReturns the average character width of this viewer's widget.intReturns the visible line with the highest line number.intReturns the document offset of the lower right corner of this viewer's view port.protected intgetClosestWidgetLineForModelLine(int modelLine) Returns the line of the widget whose corresponding line in the viewer's document is closest to the given line in the viewer's document or-1.Returns the primary control associated with this viewer.Returns the currently displayed text hover if any,nullotherwise.Returns the text viewer's input document.protected StringReturns the document partitioning for this viewer.protected intThe delay in milliseconds before an empty selection changed event is sent by the cursor listener.protected final IRegiongetExtent(int start, int end) Returns the region covered by the given start and end offset.protected FindReplaceDocumentAdapterReturns the find/replace document adapter.Returns the find/replace operation target of this viewer.Returns the location at which the most recent mouse hover event has occurred.getInput()Returns the input.Returns the last known selection from a cache, without polling widget.intgetMark()Returns the position of the mark,-1if the mark is not set.Implements the contract ofITextViewerExtension5.getModelCoverage().protected PaintManagerReturns the paint manager of this viewer.Returns the current editor helpers.Returns the viewer's rewrite target.Returns the range of the current selection in coordinates of this viewer's document.Returns the current selection for this provider.Returns a selection provider dedicated to this viewer.protected ISlaveDocumentManagerReturns the slave document managerprotected ITextHovergetTextHover(int offset) Returns the text hover for a given offset.protected ITextHovergetTextHover(int offset, int stateMask) Returns the text hover for a given offset and a given state mask.protected AbstractInformationControlManagerReturns the text hovering controller of this viewer.Returns the text operation target of this viewer.Returns this viewer's SWT control,nullif the control is disposed.intReturns the visible line with the smallest line number.intReturns the document offset of the upper left corner of this viewer's view port.intReturns the vertical offset of the first visible line.Returns this viewer's undo manager.protected IDocumentReturns the viewer's visible document.protected intDeprecated.as of 3.2Returns the current visible region of this viewer's document.protected final intgetWidthInPixels(int offset, int length) Returns the width of the representation of a text range in the visible region of the viewer's document as drawn in this viewer's widget.protected final intgetWidthInPixels(String text) Deprecated.usegetWidthInPixels(int, int)insteadprotected voidFrees all resources allocated by this viewer.protected voidHandles the verify event issued by the viewer's text widget.protected voidHook method called when the visible document is about to be changed.protected voidHook method called when the visible document has been changed.protected voidignoreAutoEditStrategies(boolean ignore) Tells this viewer whether the registered auto edit strategies should be ignored.protected voidinitializeDocumentInformationMapping(IDocument visibleDocument) Initializes the document information mapping between the given slave document and its master document.protected voidinputChanged(Object newInput, Object oldInput) Internal hook method called when the input to this viewer is initially set or subsequently changed.protected voidinternalRevealRange(int start, int end) Reveals the given range of the visible document.final voidMarks the currently applied text presentation as invalid.final voidinvalidateTextPresentation(int offset, int length) Invalidates the given range of the text presentation.protected booleanA block is selected if the character preceding the start of the selection is a new line character.booleanReturns whether the shown text can be manipulated.protected booleanReturns whether this viewer ignores the registered auto edit strategies.protected booleanReturns whether the shown text can be printed.protected voidmarkChanged(int offset, int length) Sends out a mark selection changed event to all registered listeners.intmodelLine2WidgetLine(int modelLine) Implements the contract ofITextViewerExtension5.modelLine2WidgetLine(int).intmodelOffset2WidgetOffset(int modelOffset) Implements the contract ofITextViewerExtension5.modelOffset2WidgetOffset(int).protected IRegionmodelRange2ClosestWidgetRange(IRegion modelRange) Similar tomodelRange2WidgetRange(IRegion), but more forgiving: ifmodelRangedescribes a region entirely hidden in the image, then this method returns the zero-length region at the offset of the folded region.modelRange2WidgetRange(IRegion modelRange) Implements the contract ofITextViewerExtension5.modelRange2WidgetRange(IRegion).protected IRegionmodelRange2WidgetRange(Position modelPosition) Same asmodelRange2WidgetRange(IRegion)just for aPosition.protected PointmodelSelection2WidgetSelection(Point modelSelection) Translates the given selection range of the viewer's document into the corresponding widget range or returnsnullof this fails.protected StyleRangeTranslates a style range given relative to the viewer's document into style ranges relative to the viewer's widget ornull.booleanInstructs the receiver to request theIWidgetTokenKeepercurrently holding the widget token to take the keyboard focus.booleanoverlapsWithVisibleRegion(int start, int length) Returns whether a given range overlaps with the visible region of this viewer's document.voidprependAutoEditStrategy(IAutoEditStrategy strategy, String contentType) Prepends the given auto edit strategy to the existing list of strategies for the specified content type.voidprependVerifyKeyListener(VerifyKeyListener listener) Inserts the verify key listener at the beginning of the viewer's list of verify key listeners.protected voidprint()Brings up a print dialog and callsprintContents(Printer)which performs the actual print.voidprint(StyledTextPrintOptions options) Print the text viewer contents using the given options.protected final booleanredraws()Returns whether this viewer redraws itself.voidrefresh()Refreshes this viewer completely with information freshly obtained from this viewer's model.voidregister(IEditingSupport helper) Register a support with the registry.voidreleaseWidgetToken(IWidgetTokenKeeper tokenKeeper) The given token keeper releases the token to this token owner.voidremoveAutoEditStrategy(IAutoEditStrategy strategy, String contentType) Removes the first occurrence of the given auto edit strategy in the list of strategies registered under the specified content type.voidremovePainter(IPainter painter) Removes the given painter from this viewer.voidRemoves the given listener for post selection changes from this selection provider.voidremoveTextHovers(String contentType) Removes all text hovers for the given content type independent from their state mask.voidremoveTextInputListener(ITextInputListener listener) Removes the given listener from this viewer's set of text input listeners.voidremoveTextListener(ITextListener listener) Removes the given listener from this viewer's set of text listeners.voidRemoves the given text presentation listener from this text viewer.voidremoveVerifyKeyListener(VerifyKeyListener listener) Removes the verify key listener from the viewer's list of verify key listeners.voidremoveViewportListener(IViewportListener listener) Removes the given listener from this viewer's set of view port listeners.booleanrequestWidgetToken(IWidgetTokenKeeper requester) Requests the widget token from this token owner.booleanrequestWidgetToken(IWidgetTokenKeeper requester, int priority) Requests the widget token from this token owner.voidResets the installed plug-ins.voidResets the region of this viewer's document which is visible in the presentation.voidrevealRange(int start, int length) Ensures that the given range is visible.protected ObjectselectContentTypePlugin(int offset, Map<String, ?> plugins) Selects from the given map the one which is registered under the content type of the partition in which the given offset is located.protected voidselectionChanged(int offset, int length) Sends out a text selection changed event to all registered listeners and registers the selection changed event to be sent out to all post selection listeners.protected final voidsetAutoEditStrategies(IAutoEditStrategy[] strategies, String contentType) Sets the given edit strategy as the only strategy for the given content type.voidsetAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType) Deprecated.voidsetDefaultPrefixes(String[] defaultPrefixes, String contentType) Sets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation.voidsetDocument(IDocument document) Sets the given document as the text viewer's model and updates the presentation accordingly.voidsetDocument(IDocument document, int modelRangeOffset, int modelRangeLength) Sets the given document as this viewer's model and exposes the specified region.voidsetDocumentPartitioning(String partitioning) Sets the document partitioning of this viewer.voidsetEditable(boolean editable) Sets the editable state.voidsetEventConsumer(IEventConsumer consumer) Registers an event consumer with this viewer.voidSets the creator for the hover controls.voidSets the hover enrich mode.voidsetHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask) Sets this viewer's hyperlink detectors for the given state mask.voidsetHyperlinkPresenter(IHyperlinkPresenter hyperlinkPresenter) Sets the hyperlink presenter.voidsetIndentPrefixes(String[] indentPrefixes, String contentType) Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation.voidSets or clears the input for this viewer.voidsetMark(int offset) Sets a mark at the given offset or clears the mark if the specified offset is-1.final voidsetRedraw(boolean redraw) Enables/disables the redrawing of this text viewer.protected final voidsetRedraw(boolean redraw, int topIndex) Basically same functionality asITextViewerExtension.setRedraw(boolean).voidsetSelectedRange(int selectionOffset, int selectionLength) Sets the selection to the specified range.voidsetSelection(ISelection selection, boolean reveal) Sets a new selection for this viewer and optionally makes it visible.voidsetTabsToSpacesConverter(IAutoEditStrategy converter) Sets an auto edit strategy can converts tabs to spaces.voidsetTextColor(Color color) Applies the given color as text foreground color to this viewer's selection.voidsetTextColor(Color color, int start, int length, boolean controlRedraw) Applies the given color as text foreground color to the specified section of this viewer.voidsetTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType) Sets this viewer's text double click strategy for the given content type.voidsetTextHover(ITextHover hover, String contentType) Sets this viewer's text hover for the given content type.voidsetTextHover(ITextHover hover, String contentType, int stateMask) Sets this viewer's text hover for the given content type and the given state mask.voidsetTopIndex(int index) Scrolls the widget so that the given index is the line with the smallest line number of all visible lines.voidsetUndoManager(IUndoManager undoManager) Sets this viewer's undo manager.protected voidsetVisibleDocument(IDocument document) Sets this viewer's visible document.voidsetVisibleRegion(int start, int length) Defines and sets the region of this viewer's document which will be visible in the presentation.protected voidshift(boolean useDefaultPrefixes, boolean right) Deprecated.use shift(boolean, boolean, boolean) insteadprotected voidshift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace) Shifts a text block to the right or left using the specified set of prefix characters.protected final voidstartSequentialRewriteMode(boolean normalized) Deprecated.since 3.1 useIDocumentExtension4.startRewriteSession(DocumentRewriteSessionType)insteadprotected final voidDeprecated.since 3.1 useIDocumentExtension4.stopRewriteSession(DocumentRewriteSession)insteadvoidunregister(IEditingSupport helper) Deregister a support with the registry.protected booleanupdateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) Updates the given slave document to show the specified range of its master document.protected voidInforms all registered text listeners about the change specified by the widget command.protected voidupdateViewportListeners(int origin) Checks whether the view port changed and if so informs all registered listeners about the change.protected booleanupdateVisibleDocument(IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength) Deprecated.useupdateSlaveDocumentinsteadprotected voidvalidateSelectionRange(int[] selectionRange) Validates and adapts the given selection range if it is not a valid widget selection.intwidgetLine2ModelLine(int widgetLine) Implements the contract ofITextViewerExtension5.widgetLine2ModelLine(int).intwidgetLineOfWidgetOffset(int widgetOffset) Implements the contract ofITextViewerExtension5.widgetLineOfWidgetOffset(int).intwidgetlLine2ModelLine(int widgetLine) Implements the contract ofITextViewerExtension5.widgetLine2ModelLine(int).intwidgetOffset2ModelOffset(int widgetOffset) Implements the contract ofITextViewerExtension5.widgetOffset2ModelOffset(int).widgetRange2ModelRange(IRegion widgetRange) Implements the contract ofITextViewerExtension5.widgetRange2ModelRange(IRegion).protected PointwidgetSelection2ModelSelection(Point widgetSelection) Translates the given widget selection into the corresponding region of the viewer's document or returnsnullif this fails.Methods inherited from class org.eclipse.jface.viewers.VieweraddHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelectionMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jface.viewers.ISelectionProvideraddSelectionChangedListener, removeSelectionChangedListener, setSelection
- 
Field Details- 
TRACE_ERRORSpublic static final boolean TRACE_ERRORSInternal flag to indicate the debug state.- See Also:
 
- 
SCROLLERprotected static final int SCROLLERIdentifies the scrollbars as originators of a view port change.- See Also:
 
- 
MOUSEprotected static final int MOUSEIdentifies mouse moves as originators of a view port change.- See Also:
 
- 
MOUSE_ENDprotected static final int MOUSE_ENDIdentifies mouse button up as originator of a view port change.- See Also:
 
- 
KEYprotected static final int KEYIdentifies key strokes as originators of a view port change.- See Also:
 
- 
RESIZEprotected static final int RESIZEIdentifies window resizing as originator of a view port change.- See Also:
 
- 
INTERNALprotected static final int INTERNALIdentifies internal reasons as originators of a view port change.- See Also:
 
- 
SHIFTINGInternal name of the position category used selection preservation during shift.- See Also:
 
- 
fMarkPositionThe mark position.- Since:
- 2.0
 
- 
fIgnoreAutoIndentprotected boolean fIgnoreAutoIndentShould the auto indent strategies ignore the next edit operation
- 
fIndentCharsThe strings a line is prefixed with on SHIFT_RIGHT and removed from each line on SHIFT_LEFT
- 
fDefaultPrefixCharsThe string a line is prefixed with on PREFIX and removed from each line on STRIP_PREFIX
- 
fDoubleClickStrategiesThe text viewer's text double click strategies
- 
fUndoManagerThe text viewer's undo manager
- 
fAutoIndentStrategiesThe text viewer's auto indent strategies
- 
fTextHoversThe text viewer's text hovers
- 
fViewportListenersAll registered view port listeners
- 
fLastTopPixelprotected int fLastTopPixelThe last visible vertical position of the top line
- 
fTextListenersAll registered text listeners
- 
fTextInputListenersAll registered text input listeners
- 
fEventConsumerThe text viewer's event consumer
- 
fReplaceTextPresentationprotected boolean fReplaceTextPresentationIndicates whether the viewer's text presentation should be replaced are modified.
- 
fHoverControlCreatorThe creator of the text hover control- Since:
- 2.0
 
- 
fInformationMappingThe mapping between model and visible document.- Since:
- 2.1
 
- 
fPaintManagerThe viewer's paint manager.- Since:
- 2.1
 
- 
fPartitioningThe viewers partitioning. I.e. the partitioning name the viewer uses to access partitioning information of its input document.- Since:
- 3.0
 
- 
fTextPresentationListenersAll registered text presentation listeners. since 3.0
- 
fFindReplaceDocumentAdapterThe find/replace document adapter.- Since:
- 3.0
 
- 
fHyperlinkDetectorsThe text viewer's hyperlink detectors.- Since:
- 3.1
 
- 
fHyperlinkPresenterThe text viewer's hyperlink presenter.- Since:
- 3.1
 
- 
fHyperlinkManagerThe text viewer's hyperlink manager.- Since:
- 3.1
 
- 
fHyperlinkStateMaskprotected int fHyperlinkStateMaskThe SWT key modifier mask which in combination with the left mouse button triggers the hyperlink mode.- Since:
- 3.1
 
 
- 
- 
Constructor Details- 
TextViewerprotected TextViewer()Internal use only
- 
TextViewerCreate a new text viewer with the given SWT style bits. The viewer is ready to use but does not have any plug-in installed.- Parameters:
- parent- the parent of the viewer's control
- styles- the SWT style bits for the viewer's control, if- SWT.WRAPis set then a custom document adapter needs to be provided, see- createDocumentAdapter()
 
 
- 
- 
Method Details- 
createTextWidgetFactory method to create the text widget to be used as the viewer's text widget.- Parameters:
- parent- the parent of the styled text
- styles- the styles for the styled text
- Returns:
- the text widget to be used
 
- 
createDocumentAdapterFactory method to create the document adapter to be used by this viewer.- Returns:
- the document adapter to be used
 
- 
createControlCreates the viewer's SWT control. The viewer's text widget either is the control or is a child of the control.- Parameters:
- parent- the parent of the viewer's control
- styles- the SWT style bits for the viewer's control
 
- 
getControlDescription copied from class:ViewerReturns the primary control associated with this viewer.- Specified by:
- getControlin interface- ITextViewerExtension
- Specified by:
- getControlin class- Viewer
- Returns:
- the SWT control which displays this viewer's content
 
- 
activatePluginspublic void activatePlugins()Description copied from interface:ITextViewerActivates the installed plug-ins. If the plug-ins are already activated this call has no effect.- Specified by:
- activatePluginsin interface- ITextViewer
 
- 
resetPluginspublic void resetPlugins()Description copied from interface:ITextViewerResets the installed plug-ins. If plug-ins change their state or behavior over the course of time, this method causes them to be set back to their initial state and behavior. E.g., if anIUndoManagerhas been installed on this text viewer, the manager's list of remembered text editing operations is removed.- Specified by:
- resetPluginsin interface- ITextViewer
 
- 
handleDisposeprotected void handleDispose()Frees all resources allocated by this viewer. Internally called when the viewer's control has been disposed.
- 
getTextWidgetDescription copied from interface:ITextViewerReturns this viewer's SWT control,nullif the control is disposed.Calling API directly on the widget can interfere with features provided by a text viewer. Clients who call API directly on the widget are responsible to resolve such conflicts on their side. - Specified by:
- getTextWidgetin interface- ITextViewer
- Returns:
- the SWT control or null
 
- 
getEmptySelectionChangedEventDelayprotected int getEmptySelectionChangedEventDelay()The delay in milliseconds before an empty selection changed event is sent by the cursor listener.Note: The return value is used to initialize the cursor listener. To return a non-constant value has no effect. This implementation returns OpenStrategy.getPostSelectionDelay().- Returns:
- delay in milliseconds
- Since:
- 3.0
- See Also:
 
- 
setAutoIndentStrategyDeprecated.Sets this viewer's auto indent strategy for the given content type. If the given strategy isnullany installed strategy for the content type is removed. This method has been replaced byITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategy, String)andITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategy, String). It is now equivalent toITextViewerExtension2 extension= (ITextViewerExtension2) viewer; extension.removeAutoEditStrategy(oldStrategy, contentType); extension.prependAutoEditStrategy(strategy, contentType);- Specified by:
- setAutoIndentStrategyin interface- ITextViewer
- Parameters:
- strategy- the new auto indent strategy.- nullis a valid argument.
- contentType- the type for which the strategy is registered
 
- 
setAutoEditStrategiesSets the given edit strategy as the only strategy for the given content type.- Parameters:
- strategies- the auto edit strategies
- contentType- the content type
- Since:
- 3.1
 
- 
prependAutoEditStrategyDescription copied from interface:ITextViewerExtension2Prepends the given auto edit strategy to the existing list of strategies for the specified content type. The strategies are called in the order in which they appear in the list of strategies.- Specified by:
- prependAutoEditStrategyin interface- ITextViewerExtension2
- Parameters:
- strategy- the auto edit strategy
- contentType- the content type
 
- 
removeAutoEditStrategyDescription copied from interface:ITextViewerExtension2Removes the first occurrence of the given auto edit strategy in the list of strategies registered under the specified content type.- Specified by:
- removeAutoEditStrategyin interface- ITextViewerExtension2
- Parameters:
- strategy- the auto edit strategy
- contentType- the content type
 
- 
setEventConsumerDescription copied from interface:ITextViewerRegisters an event consumer with this viewer. This method has been replaces with theVerifyKeyListenermanagement methods inITextViewerExtension.- Specified by:
- setEventConsumerin interface- ITextViewer
- Parameters:
- consumer- the viewer's event consumer.- nullis a valid argument.
 
- 
setIndentPrefixesDescription copied from interface:ITextViewerSets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation. The prefixes are considered equivalent. Thus "\t" and " " can both be used as prefix characters. Shift right always inserts the indentPrefixes[0]. Shift left removes all of the specified prefixes.- Specified by:
- setIndentPrefixesin interface- ITextViewer
- Parameters:
- indentPrefixes- the prefixes to be used
- contentType- the content type for which the prefixes are specified
 
- 
getTopInsetpublic int getTopInset()Description copied from interface:ITextViewerReturns the vertical offset of the first visible line.- Specified by:
- getTopInsetin interface- ITextViewer
- Returns:
- the vertical offset of the first visible line
 
- 
isEditablepublic boolean isEditable()Description copied from interface:ITextViewerReturns whether the shown text can be manipulated.- Specified by:
- isEditablein interface- ITextViewer
- Returns:
- the viewer's editable state
 
- 
setEditablepublic void setEditable(boolean editable) Description copied from interface:ITextViewerSets the editable state.- Specified by:
- setEditablein interface- ITextViewer
- Parameters:
- editable- the editable state
 
- 
setDefaultPrefixesDescription copied from interface:ITextViewerSets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation. The prefixes are considered equivalent. Inserting a prefix always inserts the defaultPrefixes[0]. Removing a prefix removes all of the specified prefixes.- Specified by:
- setDefaultPrefixesin interface- ITextViewer
- Parameters:
- defaultPrefixes- the prefixes to be used
- contentType- the content type for which the prefixes are specified
 
- 
setUndoManagerDescription copied from interface:ITextViewerSets this viewer's undo manager.- Specified by:
- setUndoManagerin interface- ITextViewer
- Parameters:
- undoManager- the new undo manager.- nullis a valid argument.
 
- 
getUndoManagerDescription copied from interface:ITextViewerExtension6Returns this viewer's undo manager.- Specified by:
- getUndoManagerin interface- ITextViewerExtension6
- Returns:
- the undo manager or nullif it has not been plugged-in
 
- 
setTextHoverDescription copied from interface:ITextViewerSets this viewer's text hover for the given content type.This method has been replaced by ITextViewerExtension2.setTextHover(ITextHover, String, int). It is now equivalent toITextViewerExtension2 extension= (ITextViewerExtension2) document; extension.setTextHover(textViewerHover, contentType, ITextViewerExtension2#DEFAULT_HOVER_STATE_MASK);- Specified by:
- setTextHoverin interface- ITextViewer
- Parameters:
- hover- the new hover.- nullis a valid argument.
- contentType- the type for which the hover is registered
 
- 
setTextHoverDescription copied from interface:ITextViewerExtension2Sets this viewer's text hover for the given content type and the given state mask. If the given text hover isnull, any hover installed for the given content type and state mask is removed.- Specified by:
- setTextHoverin interface- ITextViewerExtension2
- Parameters:
- hover- the new hover or- null
- contentType- the type for which the hover is to be registered or unregistered
- stateMask- the SWT event state mask;- DEFAULT_HOVER_STATE_MASKindicates that the hover is installed as the default hover.
 
- 
removeTextHoversDescription copied from interface:ITextViewerExtension2Removes all text hovers for the given content type independent from their state mask.Note: To remove a hover for a given content type and state mask use ITextViewerExtension2.setTextHover(ITextHover, String, int)withnullas parameter for the text hover.- Specified by:
- removeTextHoversin interface- ITextViewerExtension2
- Parameters:
- contentType- the type for which all text hovers are to be unregistered
 
- 
getTextHoverReturns the text hover for a given offset.- Parameters:
- offset- the offset for which to return the text hover
- Returns:
- the text hover for the given offset
 
- 
getTextHoverReturns the text hover for a given offset and a given state mask.- Parameters:
- offset- the offset for which to return the text hover
- stateMask- the SWT event state mask
- Returns:
- the text hover for the given offset and state mask
- Since:
- 2.1
 
- 
getTextHoveringControllerReturns the text hovering controller of this viewer.- Returns:
- the text hovering controller of this viewer
- Since:
- 2.0
 
- 
setHoverControlCreatorSets the creator for the hover controls.- Parameters:
- creator- the hover control creator
- Since:
- 2.0
 
- 
setHoverEnrichModeSets the hover enrich mode. A non-nullmodedefines when hovers should be enriched once the mouse is moved into them. Ifmodeisnull, hovers are automatically closed when the mouse is moved out of thehover region.Note that a hover can only be enriched if its IInformationControlExtension5.getInformationPresenterControlCreator()is notnull.- Specified by:
- setHoverEnrichModein interface- ITextViewerExtension8
- Parameters:
- mode- the enrich mode, or- null
- Since:
- 3.4
 
- 
requestWidgetTokenDescription copied from interface:IWidgetTokenOwnerRequests the widget token from this token owner. Returnstrueif the token has been acquired or is already owned by the requester. This method is non-blocking.Replaced by IWidgetTokenOwnerExtension.requestWidgetToken(IWidgetTokenKeeper, int).- Specified by:
- requestWidgetTokenin interface- IWidgetTokenOwner
- Parameters:
- requester- the token requester
- Returns:
- trueif requester acquires the token,- falseotherwise
 
- 
requestWidgetTokenDescription copied from interface:IWidgetTokenOwnerExtensionRequests the widget token from this token owner. Returnstrueif the token has been acquired or is already owned by the requester. This method is non-blocking.priorityis forwarded to any existing token keeper to give it an estimate on whether the request has higher priority than the current keeper's. There is, however, no guarantee that another keeper will release the token even if it has a high priority.- Specified by:
- requestWidgetTokenin interface- IWidgetTokenOwnerExtension
- Parameters:
- requester- the token requester
- priority- the priority of the request
- Returns:
- trueif requester acquires the token,- falseotherwise
 
- 
releaseWidgetTokenDescription copied from interface:IWidgetTokenOwnerThe given token keeper releases the token to this token owner. If the token has previously not been held by the given token keeper, nothing happens. This method is non-blocking.- Specified by:
- releaseWidgetTokenin interface- IWidgetTokenOwner
- Parameters:
- tokenKeeper- the token keeper
 
- 
getLastKnownSelectionDescription copied from interface:ITextViewerExtension9Returns the last known selection from a cache, without polling widget.This may not be the current selection. Indeed, operations that change the selection without sending related events may not refresh the returned value. As opposed to ISelectionProvider.getSelection()that usually requires UI Thread, this method can run from any thread.- Specified by:
- getLastKnownSelectionin interface- ITextViewerExtension9
- Returns:
- the last known selection.
 
- 
getSelectedRangeDescription copied from interface:ITextViewerReturns the range of the current selection in coordinates of this viewer's document.- Specified by:
- getSelectedRangein interface- ITextViewer
- Returns:
- a Pointwith x as the offset and y as the length of the current selection
 
- 
setSelectedRangepublic void setSelectedRange(int selectionOffset, int selectionLength) Description copied from interface:ITextViewerSets the selection to the specified range.- Specified by:
- setSelectedRangein interface- ITextViewer
- Parameters:
- selectionOffset- the offset of the selection range
- selectionLength- the length of the selection range. A negative length places the caret at the visual start of the selection.
 
- 
validateSelectionRangeprotected void validateSelectionRange(int[] selectionRange) Validates and adapts the given selection range if it is not a valid widget selection. The widget selection is invalid if it starts or ends inside a multi-character line delimiter. If so, the selection is adapted to start after the divided line delimiter and to end before the divided line delimiter. The parameter passed in is changed in-place when being adapted. An adaptation to[-1, -1]indicates that the selection range could not be validated. Subclasses may reimplement this method.- Parameters:
- selectionRange- selectionRange[0] is the offset, selectionRange[1] the length of the selection to validate.
- Since:
- 2.0
 
- 
setSelectionDescription copied from class:ViewerSets a new selection for this viewer and optionally makes it visible.Subclasses must implement this method. - Specified by:
- setSelectionin class- Viewer
- Parameters:
- selection- the new selection
- reveal-- trueif the selection is to be made visible, and- falseotherwise
 
- 
getSelectionDescription copied from interface:ISelectionProviderReturns the current selection for this provider.- Specified by:
- getSelectionin interface- ISelectionProvider
- Specified by:
- getSelectionin class- Viewer
- Returns:
- the current selection
 
- 
getSelectionProviderDescription copied from interface:ITextViewerReturns a selection provider dedicated to this viewer. Subsequent calls to this method return always the same selection provider.- Specified by:
- getSelectionProviderin interface- ITextViewer
- Returns:
- this viewer's selection provider
 
- 
addPostSelectionChangedListenerDescription copied from interface:IPostSelectionProviderAdds a listener for post selection changes in this selection provider. Has no effect if an identical listener is already registered.- Specified by:
- addPostSelectionChangedListenerin interface- IPostSelectionProvider
- Parameters:
- listener- a selection changed listener
 
- 
removePostSelectionChangedListenerDescription copied from interface:IPostSelectionProviderRemoves the given listener for post selection changes from this selection provider. Has no effect if an identical listener is not registered.- Specified by:
- removePostSelectionChangedListenerin interface- IPostSelectionProvider
- Parameters:
- listener- a selection changed listener
 
- 
firePostSelectionChangedprotected void firePostSelectionChanged(int offset, int length) Sends out a text selection changed event to all registered post selection changed listeners.- Parameters:
- offset- the offset of the newly selected range in the visible document
- length- the length of the newly selected range in the visible document
- Since:
- 3.0
 
- 
selectionChangedprotected void selectionChanged(int offset, int length) Sends out a text selection changed event to all registered listeners and registers the selection changed event to be sent out to all post selection listeners.- Parameters:
- offset- the offset of the newly selected range in the visible document
- length- the length of the newly selected range in the visible document
 
- 
fireSelectionChangedprotected void fireSelectionChanged(int offset, int length) Sends out a text selection changed event to all registered listeners.- Parameters:
- offset- the offset of the newly selected range in the visible document
- length- the length of the newly selected range in the visible document
- Since:
- 3.0
 
- 
markChangedprotected void markChanged(int offset, int length) Sends out a mark selection changed event to all registered listeners.- Parameters:
- offset- the offset of the mark selection in the visible document, the offset is- -1if the mark was cleared
- length- the length of the mark selection, may be negative if the caret is before the mark.
- Since:
- 2.0
 
- 
addTextListenerDescription copied from interface:ITextViewerAdds a text listener to this viewer. If the listener is already registered with this viewer, this call has no effect.- Specified by:
- addTextListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be added
 
- 
removeTextListenerDescription copied from interface:ITextViewerRemoves the given listener from this viewer's set of text listeners. If the listener is not registered with this viewer, this call has no effect.- Specified by:
- removeTextListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be removed
 
- 
updateTextListenersInforms all registered text listeners about the change specified by the widget command. This method does not use a robust iterator.- Parameters:
- cmd- the widget command translated into a text event sent to all text listeners
 
- 
addTextInputListenerDescription copied from interface:ITextViewerAdds a text input listener to this viewer. If the listener is already registered with this viewer, this call has no effect.- Specified by:
- addTextInputListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be added
 
- 
removeTextInputListenerDescription copied from interface:ITextViewerRemoves the given listener from this viewer's set of text input listeners. If the listener is not registered with this viewer, this call has no effect.- Specified by:
- removeTextInputListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be removed
 
- 
fireInputDocumentAboutToBeChangedInforms all registered text input listeners about the forthcoming input change, This method does not use a robust iterator.- Parameters:
- oldInput- the old input document
- newInput- the new input document
 
- 
fireInputDocumentChangedInforms all registered text input listeners about the successful input change, This method does not use a robust iterator.- Parameters:
- oldInput- the old input document
- newInput- the new input document
 
- 
getInputDescription copied from interface:IInputProviderReturns the input.- Specified by:
- getInputin interface- IInputProvider
- Specified by:
- getInputin class- Viewer
- Returns:
- the input object
 
- 
getDocumentDescription copied from interface:ITextViewerReturns the text viewer's input document.- Specified by:
- getDocumentin interface- ITextViewer
- Returns:
- the viewer's input document or nullif none
 
- 
setInputDescription copied from class:ViewerSets or clears the input for this viewer.
- 
setDocumentDescription copied from interface:ITextViewerSets the given document as the text viewer's model and updates the presentation accordingly. An appropriateTextEventis issued. This text event does not carry a related document event.- Specified by:
- setDocumentin interface- ITextViewer
- Parameters:
- document- the viewer's new input document- nullif none
 
- 
setDocumentDescription copied from interface:ITextViewerSets the given document as this viewer's model and exposes the specified region. An appropriateTextEventis issued. The text event does not carry a related document event. This method is a convenience method forsetDocument(document);setVisibleRegion(offset, length).- Specified by:
- setDocumentin interface- ITextViewer
- Parameters:
- document- the new input document or- nullif none
- modelRangeOffset- the offset of the model range
- modelRangeLength- the length of the model range
 
- 
createSlaveDocumentCreates a slave document for the given document if there is a slave document manager associated with this viewer.- Parameters:
- document- the master document
- Returns:
- the newly created slave document
- Since:
- 2.1
 
- 
updateVisibleDocument@Deprecated protected boolean updateVisibleDocument(IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength) throws BadLocationException Deprecated.useupdateSlaveDocumentinsteadSets the given slave document to the specified range of its master document.- Parameters:
- visibleDocument- the slave document
- visibleRegionOffset- the offset of the master document range
- visibleRegionLength- the length of the master document range
- Returns:
- trueif the slave has been adapted successfully
- Throws:
- BadLocationException- in case the specified range is not valid in the master document
- Since:
- 2.1
 
- 
updateSlaveDocumentprotected boolean updateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) throws BadLocationException Updates the given slave document to show the specified range of its master document.- Parameters:
- slaveDocument- the slave document
- modelRangeOffset- the offset of the master document range
- modelRangeLength- the length of the master document range
- Returns:
- trueif the slave has been adapted successfully
- Throws:
- BadLocationException- in case the specified range is not valid in the master document
- Since:
- 3.0
 
- 
addViewportListenerDescription copied from interface:ITextViewerAdds the given view port listener to this viewer. If the listener is already registered with this viewer, this call has no effect.- Specified by:
- addViewportListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be added
 
- 
removeViewportListenerDescription copied from interface:ITextViewerRemoves the given listener from this viewer's set of view port listeners. If the listener is not registered with this viewer, this call has no effect.- Specified by:
- removeViewportListenerin interface- ITextViewer
- Parameters:
- listener- the listener to be removed
 
- 
updateViewportListenersprotected void updateViewportListeners(int origin) Checks whether the view port changed and if so informs all registered listeners about the change.- Parameters:
- origin- describes under which circumstances this method has been called.
- See Also:
 
- 
getTopIndexpublic int getTopIndex()Description copied from interface:ITextViewerReturns the visible line with the smallest line number.- Specified by:
- getTopIndexin interface- ITextViewer
- Returns:
- the number of the top most visible line
 
- 
setTopIndexpublic void setTopIndex(int index) Description copied from interface:ITextViewerScrolls the widget so that the given index is the line with the smallest line number of all visible lines.- Specified by:
- setTopIndexin interface- ITextViewer
- Parameters:
- index- the line which should become the top most line
 
- 
getVisibleLinesInViewportDeprecated.as of 3.2Returns the number of lines that can fully fit into the viewport. This is computed by dividing the widget's client area height by the widget's line height. The result is only accurate if the widget does not use variable line heights - for that reason, clients should not use this method any longer and use the client area height of the text widget to find out how much content fits into it.- Returns:
- the view port height in lines
 
- 
getBottomIndexpublic int getBottomIndex()Description copied from interface:ITextViewerReturns the visible line with the highest line number.- Specified by:
- getBottomIndexin interface- ITextViewer
- Returns:
- the number of the bottom most line
 
- 
getTopIndexStartOffsetpublic int getTopIndexStartOffset()Description copied from interface:ITextViewerReturns the document offset of the upper left corner of this viewer's view port.- Specified by:
- getTopIndexStartOffsetin interface- ITextViewer
- Returns:
- the upper left corner offset
 
- 
getBottomIndexEndOffsetpublic int getBottomIndexEndOffset()Description copied from interface:ITextViewerReturns the document offset of the lower right corner of this viewer's view port. This is the visible character with the highest character position. If the content of this viewer is shorter, the position of the last character of the content is returned.- Specified by:
- getBottomIndexEndOffsetin interface- ITextViewer
- Returns:
- the lower right corner offset
 
- 
revealRangepublic void revealRange(int start, int length) Description copied from interface:ITextViewerEnsures that the given range is visible.- Specified by:
- revealRangein interface- ITextViewer
- Parameters:
- start- the offset of the range to be revealed
- length- the length of the range to be revealed
 
- 
internalRevealRangeprotected void internalRevealRange(int start, int end) Reveals the given range of the visible document.- Parameters:
- start- the start offset of the range
- end- the end offset of the range
 
- 
getWidthInPixelsDeprecated.usegetWidthInPixels(int, int)insteadReturns the width of the text when being drawn into this viewer's widget.- Parameters:
- text- the string to measure
- Returns:
- the width of the presentation of the given string
 
- 
getExtentReturns the region covered by the given start and end offset. The result is relative to the upper left corner of the widget client area.- Parameters:
- start- offset relative to the start of this viewer's view port 0 <= offset <= getCharCount()
- end- offset relative to the start of this viewer's view port 0 <= offset <= getCharCount()
- Returns:
- the region covered by start and end offset
 
- 
getWidthInPixelsprotected final int getWidthInPixels(int offset, int length) Returns the width of the representation of a text range in the visible region of the viewer's document as drawn in this viewer's widget.- Parameters:
- offset- the offset of the text range in the visible region
- length- the length of the text range in the visible region
- Returns:
- the width of the presentation of the specified text range
- Since:
- 2.0
 
- 
getAverageCharWidthprotected final int getAverageCharWidth()Returns the average character width of this viewer's widget.- Returns:
- the average character width of this viewer's widget
 
- 
refreshpublic void refresh()Description copied from class:ViewerRefreshes this viewer completely with information freshly obtained from this viewer's model.
- 
getSlaveDocumentManagerReturns the slave document manager- Returns:
- the slave document manager
- Since:
- 2.1
 
- 
createSlaveDocumentManagerCreates a new slave document manager. This implementation always returns aChildDocumentManager.- Returns:
- ISlaveDocumentManager
- Since:
- 2.1
 
- 
invalidateTextPresentationpublic final void invalidateTextPresentation()Description copied from interface:ITextViewerMarks the currently applied text presentation as invalid. It is the viewer's responsibility to take any action it can to repair the text presentation.See ITextViewerExtension2.invalidateTextPresentation(int, int)for a way to invalidate specific regions rather than the presentation as a whole.- Specified by:
- invalidateTextPresentationin interface- ITextViewer
 
- 
invalidateTextPresentationpublic final void invalidateTextPresentation(int offset, int length) Invalidates the given range of the text presentation.- Specified by:
- invalidateTextPresentationin interface- ITextViewerExtension2
- Parameters:
- offset- the offset of the range to be invalidated
- length- the length of the range to be invalidated
- Since:
- 2.1
 
- 
freeSlaveDocumentFrees the given document if it is a slave document.- Parameters:
- slave- the potential slave document
- Since:
- 3.0
 
- 
setVisibleDocumentSets this viewer's visible document. The visible document represents the visible region of the viewer's input document.- Parameters:
- document- the visible document
 
- 
handleVisibleDocumentAboutToBeChangedHook method called when the visible document is about to be changed.Subclasses may override. - Parameters:
- event- the document event
- Since:
- 3.0
 
- 
handleVisibleDocumentChangedHook method called when the visible document has been changed.Subclasses may override. - Parameters:
- event- the document event
- Since:
- 3.0
 
- 
initializeDocumentInformationMappingInitializes the document information mapping between the given slave document and its master document.- Parameters:
- visibleDocument- the slave document
- Since:
- 2.1
 
- 
getVisibleDocumentReturns the viewer's visible document.- Returns:
- the viewer's visible document
 
- 
_getVisibleRegionOffsetprotected int _getVisibleRegionOffset()Returns the offset of the visible region.- Returns:
- the offset of the visible region
 
- 
getVisibleRegionDescription copied from interface:ITextViewerReturns the current visible region of this viewer's document. The result may differ from the argument passed tosetVisibleRegionif the document has been modified since then. The visible region is supposed to be a consecutive region in viewer's input document and every character inside that region is supposed to visible in the viewer's widget.Viewers implementing ITextViewerExtension5may be forced to change the fractions of the input document that are shown, in order to fulfill this contract.- Specified by:
- getVisibleRegionin interface- ITextViewer
- Returns:
- this viewer's current visible region
 
- 
overlapsWithVisibleRegionpublic boolean overlapsWithVisibleRegion(int start, int length) Description copied from interface:ITextViewerReturns whether a given range overlaps with the visible region of this viewer's document.Viewers implementing ITextViewerExtension5may be forced to change the fractions of the input document that are shown in order to fulfill this request. This is because the overlap is supposed to be without gaps.- Specified by:
- overlapsWithVisibleRegionin interface- ITextViewer
- Parameters:
- start- the offset
- length- the length
- Returns:
- trueif the specified range overlaps with the visible region
 
- 
setVisibleRegionpublic void setVisibleRegion(int start, int length) Description copied from interface:ITextViewerDefines and sets the region of this viewer's document which will be visible in the presentation. Every character inside the specified region is supposed to be visible in the viewer's widget after that call.- Specified by:
- setVisibleRegionin interface- ITextViewer
- Parameters:
- start- the offset of the visible region
- length- the length of the visible region
 
- 
resetVisibleRegionpublic void resetVisibleRegion()Description copied from interface:ITextViewerResets the region of this viewer's document which is visible in the presentation. Afterwards, the whole input document is visible.- Specified by:
- resetVisibleRegionin interface- ITextViewer
 
- 
setTextDoubleClickStrategyDescription copied from interface:ITextViewerSets this viewer's text double click strategy for the given content type.- Specified by:
- setTextDoubleClickStrategyin interface- ITextViewer
- Parameters:
- strategy- the new double click strategy.- nullis a valid argument.
- contentType- the type for which the strategy is registered
 
- 
selectContentTypePluginSelects from the given map the one which is registered under the content type of the partition in which the given offset is located.- Parameters:
- offset- the offset for which to find the plug-in
- plugins- the map from which to choose
- Returns:
- the plug-in registered under the offset's content type or nullif none
 
- 
customizeDocumentCommandHook called on receipt of aVerifyEvent. The event has been translated into aDocumentCommandwhich can now be manipulated by interested parties. By default, the hook forwards the command to the installed instances ofIAutoEditStrategy.- Parameters:
- command- the document command representing the verify event
 
- 
handleVerifyEventHandles the verify event issued by the viewer's text widget.- Parameters:
- e- the verify event
- See Also:
 
- 
canDoOperationpublic boolean canDoOperation(int operation) Description copied from interface:ITextOperationTargetReturns whether the operation specified by the given operation code can be performed.- Specified by:
- canDoOperationin interface- ITextOperationTarget
- Parameters:
- operation- the operation code
- Returns:
- trueif the specified operation can be performed
 
- 
doOperationpublic void doOperation(int operation) Description copied from interface:ITextOperationTargetPerforms the operation specified by the operation code on the target.doOperationmust only be called ifcanDoOperationreturnstrue.- Specified by:
- doOperationin interface- ITextOperationTarget
- Parameters:
- operation- the operation code
 
- 
ignoreAutoEditStrategiesprotected void ignoreAutoEditStrategies(boolean ignore) Tells this viewer whether the registered auto edit strategies should be ignored.- Parameters:
- ignore-- trueif the strategies should be ignored.
- Since:
- 2.1
 
- 
isIgnoringAutoEditStrategiesprotected boolean isIgnoringAutoEditStrategies()Returns whether this viewer ignores the registered auto edit strategies.- Returns:
- trueif the strategies are ignored
- Since:
- 2.1
 
- 
enableOperationpublic void enableOperation(int operation, boolean enable) Description copied from interface:ITextOperationTargetExtensionEnables/disabled the given text operation.- Specified by:
- enableOperationin interface- ITextOperationTargetExtension
- Parameters:
- operation- the operation to enable/disable
- enable-- trueto enable the operation otherwise- false
 
- 
copyMarkedRegionprotected void copyMarkedRegion(boolean delete) Copies/cuts the marked region.- Parameters:
- delete-- trueif the region should be deleted rather than copied.
- Since:
- 2.0
 
- 
deleteTextDeprecated.useStyledText.invokeActioninsteadDeletes the current selection. If the selection has the length 0 the selection is automatically extended to the right - either by 1 or by the length of line delimiter if at the end of a line.
- 
isBlockSelectedprotected boolean isBlockSelected()A block is selected if the character preceding the start of the selection is a new line character.- Returns:
- trueif a block is selected
 
- 
areMultipleLinesSelectedprotected boolean areMultipleLinesSelected()Returnstrueif one line is completely selected or if multiple lines are selected. Being completely selected means that all characters except the new line characters are selected.- Returns:
- trueif one or multiple lines are selected
- Since:
- 2.0
 
- 
shiftDeprecated.use shift(boolean, boolean, boolean) insteadShifts a text block to the right or left using the specified set of prefix characters. The prefixes must start at the beginning of the line.- Parameters:
- useDefaultPrefixes- says whether the configured default or indent prefixes should be used
- right- says whether to shift to the right or the left
 
- 
shiftprotected void shift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace) Shifts a text block to the right or left using the specified set of prefix characters. If white space should be ignored the prefix characters must not be at the beginning of the line when shifting to the left. There may be whitespace in front of the prefixes.- Parameters:
- useDefaultPrefixes- says whether the configured default or indent prefixes should be used
- right- says whether to shift to the right or the left
- ignoreWhitespace- says whether whitespace in front of prefixes is allowed
- Since:
- 2.0
 
- 
isPrintableprotected boolean isPrintable()Returns whether the shown text can be printed.- Returns:
- the viewer's printable mode
 
- 
printPrint the text viewer contents using the given options.- Specified by:
- printin interface- ITextViewerExtension8
- Parameters:
- options- the print options
- Since:
- 3.4
 
- 
printprotected void print()Brings up a print dialog and callsprintContents(Printer)which performs the actual print.
- 
canPerformFindprotected boolean canPerformFind()Adheres to the contract ofIFindReplaceTarget.canPerformFind().- Returns:
- trueif find can be performed,- falseotherwise
 
- 
findAndSelect@Deprecated protected int findAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord) Deprecated.Adheres to the contract ofIFindReplaceTarget.findAndSelect(int, String, boolean, boolean, boolean).- Parameters:
- startPosition- the start position
- findString- the find string specification
- forwardSearch- the search direction
- caseSensitive-- trueif case sensitive,- falseotherwise
- wholeWord-- trueif match must be whole words,- falseotherwise
- Returns:
- the model offset of the first match
 
- 
findAndSelectprotected int findAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, boolean regExSearch) Adheres to the contract ofIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).- Parameters:
- startPosition- the start position
- findString- the find string specification
- forwardSearch- the search direction
- caseSensitive-- trueif case sensitive,- falseotherwise
- wholeWord-- trueif matches must be whole words,- falseotherwise
- regExSearch-- trueif- findStringis a regular expression,- falseotherwise
- Returns:
- the model offset of the first match
 
- 
findAndSelectInRangeprotected int findAndSelectInRange(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord, int rangeOffset, int rangeLength, boolean regExSearch) Adheres to the contract ofIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).- Parameters:
- startPosition- the start position
- findString- the find string specification
- forwardSearch- the search direction
- caseSensitive-- trueif case sensitive,- falseotherwise
- wholeWord-- trueif matches must be whole words,- falseotherwise
- rangeOffset- the search scope offset
- rangeLength- the search scope length
- regExSearch-- trueif- findStringis a regular expression,- falseotherwise
- Returns:
- the model offset of the first match
- Since:
- 3.0
 
- 
setTextColorDescription copied from interface:ITextViewerApplies the given color as text foreground color to this viewer's selection.- Specified by:
- setTextColorin interface- ITextViewer
- Parameters:
- color- the color to be applied
 
- 
setTextColorDescription copied from interface:ITextViewerApplies the given color as text foreground color to the specified section of this viewer.controlRedrawtells this viewer whether it should take care of redraw management or not.- Specified by:
- setTextColorin interface- ITextViewer
- Parameters:
- color- the color to be applied
- start- the offset of the range to be changed
- length- the length of the range to be changed
- controlRedraw- indicates whether this viewer should manage redraws
 
- 
_internalGetVisibleRegionReturns the visible region if it is not equal to the whole document. Otherwise returnsnull.- Returns:
- the viewer's visible region if smaller than input document, otherwise null
 
- 
changeTextPresentationDescription copied from interface:ITextViewerApplies the color information encoded in the given text presentation.controlRedrawtells this viewer whether it should take care of redraw management or not. If, e.g., this call is one in a sequence of multiple presentation calls, it is more appropriate to explicitly control redrawing at the beginning and the end of the sequence.- Specified by:
- changeTextPresentationin interface- ITextViewer
- Parameters:
- presentation- the presentation to be applied to this viewer
- controlRedraw- indicates whether this viewer should manage redraws
 
- 
getFindReplaceTargetDescription copied from interface:ITextViewerReturns the find/replace operation target of this viewer.- Specified by:
- getFindReplaceTargetin interface- ITextViewer
- Returns:
- the find/replace operation target of this viewer
 
- 
getFindReplaceDocumentAdapterReturns the find/replace document adapter.- Returns:
- the find/replace document adapter.
- Since:
- 3.0
 
- 
getTextOperationTargetDescription copied from interface:ITextViewerReturns the text operation target of this viewer.- Specified by:
- getTextOperationTargetin interface- ITextViewer
- Returns:
- the text operation target of this viewer
 
- 
appendVerifyKeyListenerDescription copied from interface:ITextViewerExtensionAppends a verify key listener to the viewer's list of verify key listeners. If the listener is already registered with the viewer this call moves the listener to the end of the list.- Specified by:
- appendVerifyKeyListenerin interface- ITextViewerExtension
- Parameters:
- listener- the listener to be added
 
- 
prependVerifyKeyListenerDescription copied from interface:ITextViewerExtensionInserts the verify key listener at the beginning of the viewer's list of verify key listeners. If the listener is already registered with the viewer this call moves the listener to the beginning of the list.- Specified by:
- prependVerifyKeyListenerin interface- ITextViewerExtension
- Parameters:
- listener- the listener to be inserted
 
- 
removeVerifyKeyListenerDescription copied from interface:ITextViewerExtensionRemoves the verify key listener from the viewer's list of verify key listeners. If the listener is not registered with this viewer, this call has no effect.- Specified by:
- removeVerifyKeyListenerin interface- ITextViewerExtension
- Parameters:
- listener- the listener to be removed
 
- 
getMarkpublic int getMark()Description copied from interface:ITextViewerExtensionReturns the position of the mark,-1if the mark is not set.- Specified by:
- getMarkin interface- ITextViewerExtension
- Returns:
- the position of the mark or -1if no mark is set
 
- 
setMarkpublic void setMark(int offset) Description copied from interface:ITextViewerExtensionSets a mark at the given offset or clears the mark if the specified offset is-1. If a mark is set and the selection is empty, cut and copy actions performed on this text viewer work on the region described by the positions of the mark and the cursor.- Specified by:
- setMarkin interface- ITextViewerExtension
- Parameters:
- offset- the offset of the mark
 
- 
inputChangedDescription copied from class:ViewerInternal hook method called when the input to this viewer is initially set or subsequently changed.The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer. - Overrides:
- inputChangedin class- Viewer
- Parameters:
- newInput- the new input of this viewer, or- nullif none
- oldInput- the old input element or- nullif there was previously no input
 
- 
enabledRedrawingprotected void enabledRedrawing()Enables the redrawing of this text viewer.- Since:
- 2.0
 
- 
enabledRedrawingprotected void enabledRedrawing(int topIndex) Enables the redrawing of this text viewer.- Parameters:
- topIndex- the top index to be set or- -1
- Since:
- 3.0
 
- 
disableRedrawingprotected void disableRedrawing()Disables the redrawing of this text viewer. Subclasses may extend.- Since:
- 2.0
 
- 
setRedrawpublic final void setRedraw(boolean redraw) Description copied from interface:ITextViewerExtensionEnables/disables the redrawing of this text viewer. This temporarily disconnects the viewer from its underlyingStyledTextwidget. While being disconnected only the viewer's selection may be changed usingsetSelectedRange. Any direct manipulation of the widget as well as calls to methods that change the viewer's presentation state (such as enabling the segmented view) are not allowed. When redrawing is disabled the viewer does not send out any selection or view port change notification. When redrawing is enabled again, a selection change notification is sent out for the selected range and this range is revealed causing a view port changed notification.- Specified by:
- setRedrawin interface- ITextViewerExtension
- Parameters:
- redraw-- trueto enable redrawing,- falseotherwise
 
- 
setRedrawprotected final void setRedraw(boolean redraw, int topIndex) Basically same functionality asITextViewerExtension.setRedraw(boolean). Adds a way for subclasses to pass in a desired top index that should be used whenredrawistrue. IftopIndexis -1, this method is identical toITextViewerExtension.setRedraw(boolean).- Parameters:
- redraw-- trueif redraw is enabled
- topIndex- the top index
- Since:
- 3.0
- See Also:
 
- 
redrawsprotected final boolean redraws()Returns whether this viewer redraws itself.- Returns:
- trueif this viewer redraws itself
- Since:
- 2.0
 
- 
startSequentialRewriteModeDeprecated.since 3.1 useIDocumentExtension4.startRewriteSession(DocumentRewriteSessionType)insteadStarts the sequential rewrite mode of the viewer's document.- Parameters:
- normalized-- trueif the rewrite is performed from the start to the end of the document
- Since:
- 2.0
 
- 
stopSequentialRewriteModeDeprecated.since 3.1 useIDocumentExtension4.stopRewriteSession(DocumentRewriteSession)insteadSets the sequential rewrite mode of the viewer's document.- Since:
- 2.0
 
- 
getRewriteTargetDescription copied from interface:ITextViewerExtensionReturns the viewer's rewrite target.- Specified by:
- getRewriteTargetin interface- ITextViewerExtension
- Returns:
- the viewer's rewrite target
 
- 
getCurrentTextHoverDescription copied from interface:ITextViewerExtension2Returns the currently displayed text hover if any,nullotherwise.- Specified by:
- getCurrentTextHoverin interface- ITextViewerExtension2
- Returns:
- the currently displayed text hover or null
 
- 
getHoverEventLocationDescription copied from interface:ITextViewerExtension2Returns the location at which the most recent mouse hover event has occurred.- Specified by:
- getHoverEventLocationin interface- ITextViewerExtension2
- Returns:
- the location of the most recent mouse hover event
 
- 
getPaintManagerReturns the paint manager of this viewer.- Returns:
- the paint manager of this viewer
- Since:
- 2.1
 
- 
addPainterAdds the given painter to this viewer. If the painter is already registered this method is without effect.- Specified by:
- addPainterin interface- ITextViewerExtension2
- Parameters:
- painter- the painter to be added
- Since:
- 2.1
 
- 
removePainterRemoves the given painter from this viewer. If the painter has previously not been added to this viewer this method is without effect.- Specified by:
- removePainterin interface- ITextViewerExtension2
- Parameters:
- painter- the painter to be removed
- Since:
- 2.1
 
- 
modelLine2WidgetLinepublic int modelLine2WidgetLine(int modelLine) Implements the contract ofITextViewerExtension5.modelLine2WidgetLine(int).- Parameters:
- modelLine- the model line
- Returns:
- the corresponding widget line or -1
- Since:
- 2.1
 
- 
modelOffset2WidgetOffsetpublic int modelOffset2WidgetOffset(int modelOffset) Implements the contract ofITextViewerExtension5.modelOffset2WidgetOffset(int).- Parameters:
- modelOffset- the model offset
- Returns:
- the corresponding widget offset or -1
- Since:
- 2.1
 
- 
modelRange2WidgetRangeImplements the contract ofITextViewerExtension5.modelRange2WidgetRange(IRegion).- Parameters:
- modelRange- the model range
- Returns:
- the corresponding widget range or null
- Since:
- 2.1
 
- 
modelRange2ClosestWidgetRangeSimilar tomodelRange2WidgetRange(IRegion), but more forgiving: ifmodelRangedescribes a region entirely hidden in the image, then this method returns the zero-length region at the offset of the folded region.- Parameters:
- modelRange- the model range
- Returns:
- the corresponding widget range, or null
- Since:
- 3.1
 
- 
widgetlLine2ModelLinepublic int widgetlLine2ModelLine(int widgetLine) Implements the contract ofITextViewerExtension5.widgetLine2ModelLine(int).- Parameters:
- widgetLine- the widget line
- Returns:
- the corresponding model line
- Since:
- 2.1
 
- 
widgetLine2ModelLinepublic int widgetLine2ModelLine(int widgetLine) Implements the contract ofITextViewerExtension5.widgetLine2ModelLine(int).- Parameters:
- widgetLine- the widget line
- Returns:
- the corresponding model line or -1
- Since:
- 3.0
 
- 
widgetOffset2ModelOffsetpublic int widgetOffset2ModelOffset(int widgetOffset) Implements the contract ofITextViewerExtension5.widgetOffset2ModelOffset(int).- Parameters:
- widgetOffset- the widget offset
- Returns:
- the corresponding model offset or -1
- Since:
- 2.1
 
- 
widgetRange2ModelRangeImplements the contract ofITextViewerExtension5.widgetRange2ModelRange(IRegion).- Parameters:
- widgetRange- the widget range
- Returns:
- the corresponding model range or null
- Since:
- 2.1
 
- 
getModelCoverageImplements the contract ofITextViewerExtension5.getModelCoverage().- Returns:
- the model coverage
- Since:
- 2.1
 
- 
getClosestWidgetLineForModelLineprotected int getClosestWidgetLineForModelLine(int modelLine) Returns the line of the widget whose corresponding line in the viewer's document is closest to the given line in the viewer's document or-1.- Parameters:
- modelLine- the line in the viewer's document
- Returns:
- the line in the widget that corresponds best to the given line in the viewer's document or -1
- Since:
- 2.1
 
- 
modelStyleRange2WidgetStyleRangeTranslates a style range given relative to the viewer's document into style ranges relative to the viewer's widget ornull.- Parameters:
- range- the style range in the coordinates of the viewer's document
- Returns:
- the style range in the coordinates of the viewer's widget or null
- Since:
- 2.1
 
- 
modelRange2WidgetRangeSame asmodelRange2WidgetRange(IRegion)just for aPosition.- Parameters:
- modelPosition- the position describing a range in the viewer's document
- Returns:
- a region describing a range in the viewer's widget
- Since:
- 2.1
 
- 
event2ModelRangeTranslates the widget region of the given verify event into the corresponding region of the viewer's document.- Parameters:
- event- the verify event
- Returns:
- the region of the viewer's document corresponding to the verify event
- Since:
- 2.1
 
- 
widgetSelection2ModelSelectionTranslates the given widget selection into the corresponding region of the viewer's document or returnsnullif this fails.- Parameters:
- widgetSelection- the widget selection
- Returns:
- the region of the viewer's document corresponding to the widget selection or null
- Since:
- 2.1
 
- 
modelSelection2WidgetSelectionTranslates the given selection range of the viewer's document into the corresponding widget range or returnsnullof this fails.- Parameters:
- modelSelection- the selection range of the viewer's document
- Returns:
- the widget range corresponding to the selection range or null
- Since:
- 2.1
 
- 
widgetLineOfWidgetOffsetpublic int widgetLineOfWidgetOffset(int widgetOffset) Implements the contract ofITextViewerExtension5.widgetLineOfWidgetOffset(int).- Parameters:
- widgetOffset- the widget offset
- Returns:
- the corresponding widget line or -1
- Since:
- 2.1
 
- 
moveFocusToWidgetTokenpublic boolean moveFocusToWidgetToken()Description copied from interface:ITextViewerExtension4Instructs the receiver to request theIWidgetTokenKeepercurrently holding the widget token to take the keyboard focus.- Specified by:
- moveFocusToWidgetTokenin interface- ITextViewerExtension4
- Returns:
- trueif there was any- IWidgetTokenKeeperthat was asked to take the focus,- falseotherwise
 
- 
setDocumentPartitioningSets the document partitioning of this viewer. The partitioning is used by this viewer to access partitioning information of the viewers input document.- Parameters:
- partitioning- the partitioning name
- Since:
- 3.0
 
- 
getDocumentPartitioningReturns the document partitioning for this viewer.- Returns:
- the document partitioning for this viewer
- Since:
- 3.0
 
- 
addTextPresentationListenerDescription copied from interface:ITextViewerExtension4Adds the given text presentation listener to this text viewer. This call has no effect if the listener is already registered with this text viewer.- Specified by:
- addTextPresentationListenerin interface- ITextViewerExtension4
- Parameters:
- listener- the text presentation listener
 
- 
removeTextPresentationListenerDescription copied from interface:ITextViewerExtension4Removes the given text presentation listener from this text viewer. This call has no effect if the listener is not registered with this text viewer.- Specified by:
- removeTextPresentationListenerin interface- ITextViewerExtension4
- Parameters:
- listener- the text presentation listener
 
- 
registerDescription copied from interface:IEditingSupportRegistryRegister a support with the registry. If the support is already registered, nothing happens.- Specified by:
- registerin interface- IEditingSupportRegistry
- Parameters:
- helper- an editor support
 
- 
unregisterDescription copied from interface:IEditingSupportRegistryDeregister a support with the registry. If the support is not registered, orsupportisnull, nothing happens.- Specified by:
- unregisterin interface- IEditingSupportRegistry
- Parameters:
- helper- the helper to deregister, or- null
 
- 
getRegisteredSupportsDescription copied from interface:IEditingSupportRegistryReturns the current editor helpers.- Specified by:
- getRegisteredSupportsin interface- IEditingSupportRegistry
- Returns:
- an non- nullarray of currently registered editor helpers
 
- 
setHyperlinkDetectorsDescription copied from interface:ITextViewerExtension6Sets this viewer's hyperlink detectors for the given state mask.- Specified by:
- setHyperlinkDetectorsin interface- ITextViewerExtension6
- Parameters:
- hyperlinkDetectors- the new array of hyperlink detectors,- nullor an empty array to disable hyperlinking
- eventStateMask- the SWT event state mask to activate hyperlink mode
 
- 
setHyperlinkPresenterpublic void setHyperlinkPresenter(IHyperlinkPresenter hyperlinkPresenter) throws IllegalStateException Sets the hyperlink presenter.This is only valid as long as the hyperlink manager hasn't been created yet. - Parameters:
- hyperlinkPresenter- the hyperlink presenter
- Throws:
- IllegalStateException- if the hyperlink manager has already been created
- Since:
- 3.1
 
- 
setTabsToSpacesConverterDescription copied from interface:ITextViewerExtension7Sets an auto edit strategy can converts tabs to spaces.- Specified by:
- setTabsToSpacesConverterin interface- ITextViewerExtension7
- Parameters:
- converter- the converter or- nullif none should be used
 
 
- 
StyledText.invokeActioninstead