public class TextViewer extends Viewer implements ITextViewer, ITextViewerExtension, ITextViewerExtension2, ITextViewerExtension4, ITextViewerExtension6, IEditingSupportRegistry, ITextOperationTarget, ITextOperationTargetExtension, IWidgetTokenOwner, IWidgetTokenOwnerExtension, IPostSelectionProvider
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.
| Modifier and Type | Class and Description |
|---|---|
protected class |
TextViewer.TextHoverKey
Value object used as key in the text hover configuration table.
|
protected class |
TextViewer.WidgetCommand
Represents 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.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map |
fAutoIndentStrategies
The text viewer's auto indent strategies
|
protected Map |
fDefaultPrefixChars
The string a line is prefixed with on PREFIX and removed from each line on STRIP_PREFIX
|
protected Map |
fDoubleClickStrategies
The text viewer's text double click strategies
|
protected IEventConsumer |
fEventConsumer
The text viewer's event consumer
|
protected FindReplaceDocumentAdapter |
fFindReplaceDocumentAdapter
The find/replace document adapter.
|
protected IInformationControlCreator |
fHoverControlCreator
The creator of the text hover control
|
protected IHyperlinkDetector[] |
fHyperlinkDetectors
The text viewer's hyperlink detectors.
|
protected HyperlinkManager |
fHyperlinkManager
The text viewer's hyperlink manager.
|
protected IHyperlinkPresenter |
fHyperlinkPresenter
The text viewer's hyperlink presenter.
|
protected int |
fHyperlinkStateMask
The SWT key modifier mask which in combination
with the left mouse button triggers the hyperlink mode.
|
protected boolean |
fIgnoreAutoIndent
Should the auto indent strategies ignore the next edit operation
|
protected Map |
fIndentChars
The strings a line is prefixed with on SHIFT_RIGHT and removed from each line on SHIFT_LEFT
|
protected IDocumentInformationMapping |
fInformationMapping
The mapping between model and visible document.
|
protected int |
fLastTopPixel
The last visible vertical position of the top line
|
protected Position |
fMarkPosition
The mark position.
|
protected PaintManager |
fPaintManager
The viewer's paint manager.
|
protected String |
fPartitioning
The viewers partitioning.
|
protected boolean |
fReplaceTextPresentation
Indicates whether the viewer's text presentation should be replaced are modified.
|
protected Map |
fTextHovers
The text viewer's text hovers
|
protected List |
fTextInputListeners
All registered text input listeners
|
protected List |
fTextListeners
All registered text listeners
|
protected List |
fTextPresentationListeners
All registered text presentation listeners.
|
protected IUndoManager |
fUndoManager
The text viewer's undo manager
|
protected List |
fViewportListeners
All registered view port listeners>
|
protected static int |
INTERNAL
Identifies internal reasons as originators of a view port change.
|
protected static int |
KEY
Identifies key strokes as originators of a view port change.
|
protected static int |
MOUSE
Identifies mouse moves as originators of a view port change.
|
protected static int |
MOUSE_END
Identifies mouse button up as originator of a view port change.
|
protected static int |
RESIZE
Identifies window resizing as originator of a view port change.
|
protected static int |
SCROLLER
Identifies the scrollbars as originators of a view port change.
|
protected static String |
SHIFTING
Internal name of the position category used selection preservation during shift.
|
static boolean |
TRACE_ERRORS
Internal flag to indicate the debug state.
|
WIDGET_DATA_KEYDEFAULT_HOVER_STATE_MASKCOPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDO| Modifier | Constructor and Description |
|---|---|
protected |
TextViewer()
Internal use only
|
|
TextViewer(Composite parent,
int styles)
Create a new text viewer with the given SWT style bits.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
_getVisibleRegionOffset()
Returns the offset of the visible region.
|
protected IRegion |
_internalGetVisibleRegion()
Returns the visible region if it is not equal to the whole document.
|
void |
activatePlugins()
Activates the installed plug-ins.
|
void |
addPainter(IPainter painter)
Adds the given painter to this viewer.
|
void |
addPostSelectionChangedListener(ISelectionChangedListener listener)
Adds a listener for post selection changes in this selection provider.
|
void |
addTextInputListener(ITextInputListener listener)
Adds a text input listener to this viewer.
|
void |
addTextListener(ITextListener listener)
Adds a text listener to this viewer.
|
void |
addTextPresentationListener(ITextPresentationListener listener)
Adds the given text presentation listener to this text viewer.
|
void |
addViewportListener(IViewportListener listener)
Adds the given view port listener to this viewer.
|
void |
appendVerifyKeyListener(VerifyKeyListener listener)
Appends a verify key listener to the viewer's list of verify key
listeners.
|
protected boolean |
areMultipleLinesSelected()
Returns
true if one line is completely selected or if multiple lines are selected. |
boolean |
canDoOperation(int operation)
Returns whether the operation specified by the given operation code
can be performed.
|
protected boolean |
canPerformFind()
Adheres to the contract of
IFindReplaceTarget.canPerformFind(). |
void |
changeTextPresentation(TextPresentation presentation,
boolean controlRedraw)
Applies the color information encoded in the given text presentation.
|
protected void |
copyMarkedRegion(boolean delete)
Copies/cuts the marked region.
|
protected void |
createControl(Composite parent,
int styles)
Creates the viewer's SWT control.
|
protected IDocumentAdapter |
createDocumentAdapter()
Factory method to create the document adapter to be used by this viewer.
|
protected IDocument |
createSlaveDocument(IDocument document)
Creates a slave document for the given document if there is a slave document manager
associated with this viewer.
|
protected ISlaveDocumentManager |
createSlaveDocumentManager()
Creates a new slave document manager.
|
protected StyledText |
createTextWidget(Composite parent,
int styles)
Factory method to create the text widget to be used as the viewer's text widget.
|
protected void |
customizeDocumentCommand(DocumentCommand command)
Hook called on receipt of a
VerifyEvent. |
protected void |
deleteText()
Deprecated.
use
StyledText.invokeAction instead |
protected void |
disableRedrawing()
Disables the redrawing of this text viewer.
|
void |
doOperation(int operation)
Performs the operation specified by the operation code on the target.
|
protected void |
enabledRedrawing()
Enables the redrawing of this text viewer.
|
protected void |
enabledRedrawing(int topIndex)
Enables the redrawing of this text viewer.
|
void |
enableOperation(int operation,
boolean enable)
Enables/disabled the given text operation.
|
protected IRegion |
event2ModelRange(VerifyEvent event)
Translates the widget region of the given verify event into
the corresponding region of the viewer's document.
|
protected int |
findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord)
Deprecated.
|
protected int |
findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
boolean regExSearch)
Adheres to the contract of
IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean). |
protected int |
findAndSelectInRange(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
int rangeOffset,
int rangeLength,
boolean regExSearch)
Adheres to the contract of
IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean). |
protected void |
fireInputDocumentAboutToBeChanged(IDocument oldInput,
IDocument newInput)
Informs all registered text input listeners about the forthcoming input change,
This method does not use a robust iterator.
|
protected void |
fireInputDocumentChanged(IDocument oldInput,
IDocument newInput)
Informs all registered text input listeners about the successful input change,
This method does not use a robust iterator.
|
protected void |
firePostSelectionChanged(int offset,
int length)
Sends out a text selection changed event to all registered post selection changed listeners.
|
protected void |
fireSelectionChanged(int offset,
int length)
Sends out a text selection changed event to all registered listeners.
|
protected void |
freeSlaveDocument(IDocument slave)
Frees the given document if it is a slave document.
|
protected int |
getAverageCharWidth()
Returns the average character width of this viewer's widget.
|
int |
getBottomIndex()
Returns the visible line with the highest line number.
|
int |
getBottomIndexEndOffset()
Returns the document offset of the lower right
corner of this viewer's view port.
|
protected 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. |
Control |
getControl()
Returns the primary control associated with this viewer.
|
ITextHover |
getCurrentTextHover()
Returns the currently displayed text hover if any,
null otherwise. |
IDocument |
getDocument()
Returns the text viewer's input document.
|
protected String |
getDocumentPartitioning()
Returns the document partitioning for this viewer.
|
protected int |
getEmptySelectionChangedEventDelay()
The delay in milliseconds before an empty selection
changed event is sent by the cursor listener.
|
protected IRegion |
getExtent(int start,
int end)
Returns the region covered by the given start and end offset.
|
protected FindReplaceDocumentAdapter |
getFindReplaceDocumentAdapter()
Returns the find/replace document adapter.
|
IFindReplaceTarget |
getFindReplaceTarget()
Returns the find/replace operation target of this viewer.
|
Point |
getHoverEventLocation()
Returns the location at which the most recent mouse hover event
has occurred.
|
Object |
getInput()
Returns the input.
|
int |
getMark()
Returns the position of the mark,
-1 if the mark is not set. |
IRegion |
getModelCoverage()
Implements the contract of
ITextViewerExtension5.getModelCoverage(). |
protected PaintManager |
getPaintManager()
Returns the paint manager of this viewer.
|
IEditingSupport[] |
getRegisteredSupports()
Returns the current editor helpers.
|
IRewriteTarget |
getRewriteTarget()
Returns the viewer's rewrite target.
|
Point |
getSelectedRange()
Returns the range of the current selection in coordinates of this viewer's document.
|
ISelection |
getSelection()
Returns the current selection for this provider.
|
ISelectionProvider |
getSelectionProvider()
Returns a selection provider dedicated to this viewer.
|
protected ISlaveDocumentManager |
getSlaveDocumentManager()
Returns the slave document manager
|
protected ITextHover |
getTextHover(int offset)
Returns the text hover for a given offset.
|
protected ITextHover |
getTextHover(int offset,
int stateMask)
Returns the text hover for a given offset and a given state mask.
|
protected AbstractInformationControlManager |
getTextHoveringController()
Returns the text hovering controller of this viewer.
|
ITextOperationTarget |
getTextOperationTarget()
Returns the text operation target of this viewer.
|
StyledText |
getTextWidget()
Returns this viewer's SWT control,
null if the control is disposed. |
int |
getTopIndex()
Returns the visible line with the smallest line number.
|
int |
getTopIndexStartOffset()
Returns the document offset of the upper left corner of this viewer's view port.
|
int |
getTopInset()
Returns the vertical offset of the first visible line.
|
IUndoManager |
getUndoManager()
Returns this viewer's undo manager.
|
protected IDocument |
getVisibleDocument()
Returns the viewer's visible document.
|
protected int |
getVisibleLinesInViewport()
Deprecated.
as of 3.2
|
IRegion |
getVisibleRegion()
Returns the current visible region of this viewer's document.
|
protected 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.
|
protected int |
getWidthInPixels(String text)
Deprecated.
use
getWidthInPixels(int, int) instead |
protected void |
handleDispose()
Frees all resources allocated by this viewer.
|
protected void |
handleVerifyEvent(VerifyEvent e)
Handles the verify event issued by the viewer's text widget.
|
protected void |
handleVisibleDocumentAboutToBeChanged(DocumentEvent event)
Hook method called when the visible document is about to be changed.
|
protected void |
handleVisibleDocumentChanged(DocumentEvent event)
Hook method called when the visible document has been changed.
|
protected void |
ignoreAutoEditStrategies(boolean ignore)
Tells this viewer whether the registered auto edit strategies should be ignored.
|
protected void |
initializeDocumentInformationMapping(IDocument visibleDocument)
Initializes the document information mapping between the given slave document and
its master document.
|
protected void |
inputChanged(Object newInput,
Object oldInput)
Internal hook method called when the input to this viewer is
initially set or subsequently changed.
|
protected void |
internalRevealRange(int start,
int end)
Reveals the given range of the visible document.
|
void |
invalidateTextPresentation()
Marks the currently applied text presentation as invalid.
|
void |
invalidateTextPresentation(int offset,
int length)
Invalidates the given range of the text presentation.
|
protected boolean |
isBlockSelected()
A block is selected if the character preceding the start of the
selection is a new line character.
|
boolean |
isEditable()
Returns whether the shown text can be manipulated.
|
protected boolean |
isIgnoringAutoEditStrategies()
Returns whether this viewer ignores the registered auto edit strategies.
|
protected boolean |
isPrintable()
Returns whether the shown text can be printed.
|
protected void |
markChanged(int offset,
int length)
Sends out a mark selection changed event to all registered listeners.
|
int |
modelLine2WidgetLine(int modelLine)
Implements the contract of
ITextViewerExtension5.modelLine2WidgetLine(int). |
int |
modelOffset2WidgetOffset(int modelOffset)
Implements the contract of
ITextViewerExtension5.modelOffset2WidgetOffset(int). |
protected IRegion |
modelRange2ClosestWidgetRange(IRegion modelRange)
Similar to
modelRange2WidgetRange(IRegion), but more forgiving:
if modelRange describes a region entirely hidden in the
image, then this method returns the zero-length region at the offset of
the folded region. |
IRegion |
modelRange2WidgetRange(IRegion modelRange)
Implements the contract of
ITextViewerExtension5.modelRange2WidgetRange(IRegion). |
protected IRegion |
modelRange2WidgetRange(Position modelPosition)
Same as
modelRange2WidgetRange(IRegion) just for a Position. |
protected Point |
modelSelection2WidgetSelection(Point modelSelection)
Translates the given selection range of the viewer's document into
the corresponding widget range or returns
null of this fails. |
protected StyleRange |
modelStyleRange2WidgetStyleRange(StyleRange range)
Translates a style range given relative to the viewer's document into style
ranges relative to the viewer's widget or
null. |
boolean |
moveFocusToWidgetToken()
Instructs the receiver to request the
IWidgetTokenKeeper
currently holding the widget token to take the keyboard focus. |
boolean |
overlapsWithVisibleRegion(int start,
int length)
Returns whether a given range overlaps with the visible region of this
viewer's document.
|
void |
prependAutoEditStrategy(IAutoEditStrategy strategy,
String contentType)
Prepends the given auto edit strategy to the existing list of strategies
for the specified content type.
|
void |
prependVerifyKeyListener(VerifyKeyListener listener)
Inserts the verify key listener at the beginning of the viewer's list of
verify key listeners.
|
protected void |
print()
Brings up a print dialog and calls
printContents(Printer) which
performs the actual print. |
protected boolean |
redraws()
Returns whether this viewer redraws itself.
|
void |
refresh()
Refreshes this viewer completely with information freshly obtained from this
viewer's model.
|
void |
register(IEditingSupport helper)
Register a support with the registry.
|
void |
releaseWidgetToken(IWidgetTokenKeeper tokenKeeper)
The given token keeper releases the token to this
token owner.
|
void |
removeAutoEditStrategy(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.
|
void |
removePainter(IPainter painter)
Removes the given painter from this viewer.
|
void |
removePostSelectionChangedListener(ISelectionChangedListener listener)
Removes the given listener for post selection changes from this selection
provider.
|
void |
removeTextHovers(String contentType)
Removes all text hovers for the given content type independent from their state mask.
|
void |
removeTextInputListener(ITextInputListener listener)
Removes the given listener from this viewer's set of text input listeners.
|
void |
removeTextListener(ITextListener listener)
Removes the given listener from this viewer's set of text listeners.
|
void |
removeTextPresentationListener(ITextPresentationListener listener)
Removes the given text presentation listener from this text viewer.
|
void |
removeVerifyKeyListener(VerifyKeyListener listener)
Removes the verify key listener from the viewer's list of verify key listeners.
|
void |
removeViewportListener(IViewportListener listener)
Removes the given listener from this viewer's set of view port listeners.
|
boolean |
requestWidgetToken(IWidgetTokenKeeper requester)
Requests the widget token from this token owner.
|
boolean |
requestWidgetToken(IWidgetTokenKeeper requester,
int priority)
Requests the widget token from this token owner.
|
void |
resetPlugins()
Resets the installed plug-ins.
|
void |
resetVisibleRegion()
Resets the region of this viewer's document which is visible in the presentation.
|
void |
revealRange(int start,
int length)
Ensures that the given range is visible.
|
protected Object |
selectContentTypePlugin(int offset,
Map 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 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.
|
protected void |
setAutoEditStrategies(IAutoEditStrategy[] strategies,
String contentType)
Sets the given edit strategy as the only strategy for the given content type.
|
void |
setAutoIndentStrategy(IAutoIndentStrategy strategy,
String contentType)
Deprecated.
|
void |
setDefaultPrefixes(String[] defaultPrefixes,
String contentType)
Sets the string that is used as prefix when lines of the given
content type are prefixed by the prefix text operation.
|
void |
setDocument(IDocument document)
Sets the given document as the text viewer's model and updates the
presentation accordingly.
|
void |
setDocument(IDocument document,
int modelRangeOffset,
int modelRangeLength)
Sets the given document as this viewer's model and
exposes the specified region.
|
void |
setDocumentPartitioning(String partitioning)
Sets the document partitioning of this viewer.
|
void |
setEditable(boolean editable)
Sets the editable state.
|
void |
setEventConsumer(IEventConsumer consumer)
Registers an event consumer with this viewer.
|
void |
setHoverControlCreator(IInformationControlCreator creator)
Sets the creator for the hover controls.
|
void |
setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors,
int eventStateMask)
Sets this viewer's hyperlinkDetectors for the given content type.
|
void |
setHyperlinkPresenter(IHyperlinkPresenter hyperlinkPresenter)
Sets the hyperlink presenter.
|
void |
setIndentPrefixes(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.
|
void |
setInput(Object input)
Sets or clears the input for this viewer.
|
void |
setMark(int offset)
Sets a mark at the given offset or clears the mark if the specified
offset is
-1. |
void |
setRedraw(boolean redraw)
Enables/disables the redrawing of this text viewer.
|
protected void |
setRedraw(boolean redraw,
int topIndex)
Basically same functionality as
ITextViewerExtension.setRedraw(boolean). |
void |
setSelectedRange(int selectionOffset,
int selectionLength)
Sets the selection to the specified range.
|
void |
setSelection(ISelection selection,
boolean reveal)
Sets a new selection for this viewer and optionally makes it visible.
|
void |
setTextColor(Color color)
Applies the given color as text foreground color to this viewer's
selection.
|
void |
setTextColor(Color color,
int start,
int length,
boolean controlRedraw)
Applies the given color as text foreground color to the specified section
of this viewer.
|
void |
setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy,
String contentType)
Sets this viewer's text double click strategy for the given content type.
|
void |
setTextHover(ITextHover hover,
String contentType)
Sets this viewer's text hover for the given content type.
|
void |
setTextHover(ITextHover hover,
String contentType,
int stateMask)
Sets this viewer's text hover for the given content type and the given state mask.
|
void |
setTopIndex(int index)
Scrolls the widget so that the given index is the line
with the smallest line number of all visible lines.
|
void |
setUndoManager(IUndoManager undoManager)
Sets this viewer's undo manager.
|
protected void |
setVisibleDocument(IDocument document)
Sets this viewer's visible document.
|
void |
setVisibleRegion(int start,
int length)
Defines and sets the region of this viewer's document which will be
visible in the presentation.
|
protected void |
shift(boolean useDefaultPrefixes,
boolean right)
Deprecated.
use shift(boolean, boolean, boolean) instead
|
protected void |
shift(boolean useDefaultPrefixes,
boolean right,
boolean ignoreWhitespace)
Shifts a text block to the right or left using the specified set of prefix characters.
|
protected void |
startSequentialRewriteMode(boolean normalized)
Deprecated.
since 3.1 use
IDocumentExtension4.startRewriteSession(DocumentRewriteSessionType) instead |
protected void |
stopSequentialRewriteMode()
Deprecated.
since 3.1 use
IDocumentExtension4.stopRewriteSession(DocumentRewriteSession) instead |
void |
unregister(IEditingSupport helper)
Deregister a support with the registry.
|
protected boolean |
updateSlaveDocument(IDocument slaveDocument,
int modelRangeOffset,
int modelRangeLength)
Updates the given slave document to show the specified range of its master document.
|
protected void |
updateTextListeners(TextViewer.WidgetCommand cmd)
Informs all registered text listeners about the change specified by the
widget command.
|
protected void |
updateViewportListeners(int origin)
Checks whether the view port changed and if so informs all registered
listeners about the change.
|
protected boolean |
updateVisibleDocument(IDocument visibleDocument,
int visibleRegionOffset,
int visibleRegionLength)
Deprecated.
use
updateSlaveDocument instead |
protected void |
validateSelectionRange(int[] selectionRange)
Validates and adapts the given selection range if it is not a valid
widget selection.
|
int |
widgetLine2ModelLine(int widgetLine)
Implements the contract of
ITextViewerExtension5.widgetLine2ModelLine(int). |
int |
widgetLineOfWidgetOffset(int widgetOffset)
Implements the contract of
ITextViewerExtension5.widgetLineOfWidgetOffset(int). |
int |
widgetlLine2ModelLine(int widgetLine)
Implements the contract of
ITextViewerExtension5.widgetLine2ModelLine(int). |
int |
widgetOffset2ModelOffset(int widgetOffset)
Implements the contract of
ITextViewerExtension5.widgetOffset2ModelOffset(int). |
IRegion |
widgetRange2ModelRange(IRegion widgetRange)
Implements the contract of
ITextViewerExtension5.widgetRange2ModelRange(IRegion). |
protected Point |
widgetSelection2ModelSelection(Point widgetSelection)
Translates the given widget selection into the corresponding region
of the viewer's document or returns
null if this fails. |
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelectionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSelectionChangedListener, removeSelectionChangedListener, setSelectionpublic static final boolean TRACE_ERRORS
protected static final int SCROLLER
protected static final int MOUSE
protected static final int MOUSE_END
protected static final int KEY
protected static final int RESIZE
protected static final int INTERNAL
protected static final String SHIFTING
protected Position fMarkPosition
protected boolean fIgnoreAutoIndent
protected Map fIndentChars
protected Map fDefaultPrefixChars
protected Map fDoubleClickStrategies
protected IUndoManager fUndoManager
protected Map fAutoIndentStrategies
protected Map fTextHovers
protected List fViewportListeners
protected int fLastTopPixel
protected List fTextListeners
protected List fTextInputListeners
protected IEventConsumer fEventConsumer
protected boolean fReplaceTextPresentation
protected IInformationControlCreator fHoverControlCreator
protected IDocumentInformationMapping fInformationMapping
protected PaintManager fPaintManager
protected String fPartitioning
protected List fTextPresentationListeners
protected FindReplaceDocumentAdapter fFindReplaceDocumentAdapter
protected IHyperlinkDetector[] fHyperlinkDetectors
protected IHyperlinkPresenter fHyperlinkPresenter
protected HyperlinkManager fHyperlinkManager
protected int fHyperlinkStateMask
protected TextViewer()
public TextViewer(Composite parent, int styles)
parent - the parent of the viewer's controlstyles - the SWT style bits for the viewer's controlprotected StyledText createTextWidget(Composite parent, int styles)
parent - the parent of the styled textstyles - the styles for the styled textprotected IDocumentAdapter createDocumentAdapter()
protected void createControl(Composite parent, int styles)
parent - the parent of the viewer's controlstyles - the SWT style bits for the viewer's controlpublic Control getControl()
ViewergetControl in interface ITextViewerExtensiongetControl in class Viewerpublic void activatePlugins()
ITextVieweractivatePlugins in interface ITextViewerpublic void resetPlugins()
ITextViewerIUndoManager
has been installed on this text viewer, the manager's list of remembered
text editing operations is removed.resetPlugins in interface ITextViewerprotected void handleDispose()
public StyledText getTextWidget()
ITextViewernull if 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.
getTextWidget in interface ITextViewernullprotected int getEmptySelectionChangedEventDelay()
Note: The return value is used to initialize the cursor listener. To return a non-constant value has no effect.
The same value (500) is used in OpenStrategy.TIME.
OpenStrategypublic void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType)
ITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategy, String) and
ITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategy, String) insteadnull any installed strategy for the
content type is removed. This method has been replaced by
ITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategy, String) and
ITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategy, String).
It is now equivalent to
ITextViewerExtension2 extension= (ITextViewerExtension2) viewer;
extension.removeAutoEditStrategy(oldStrategy, contentType);
extension.prependAutoEditStrategy(strategy, contentType);
setAutoIndentStrategy in interface ITextViewerstrategy - the new auto indent strategy. null is a
valid argument.contentType - the type for which the strategy is registeredprotected final void setAutoEditStrategies(IAutoEditStrategy[] strategies, String contentType)
strategies - the auto edit strategiescontentType - the content typepublic void prependAutoEditStrategy(IAutoEditStrategy strategy, String contentType)
ITextViewerExtension2prependAutoEditStrategy in interface ITextViewerExtension2strategy - the auto edit strategycontentType - the content typepublic void removeAutoEditStrategy(IAutoEditStrategy strategy, String contentType)
ITextViewerExtension2removeAutoEditStrategy in interface ITextViewerExtension2strategy - the auto edit strategycontentType - the content typepublic void setEventConsumer(IEventConsumer consumer)
ITextViewerVerifyKeyListener
management methods in ITextViewerExtension.setEventConsumer in interface ITextViewerconsumer - the viewer's event consumer. null is a
valid argument.public void setIndentPrefixes(String[] indentPrefixes, String contentType)
ITextViewersetIndentPrefixes in interface ITextViewerindentPrefixes - the prefixes to be usedcontentType - the content type for which the prefixes are specifiedpublic int getTopInset()
ITextViewergetTopInset in interface ITextViewerpublic boolean isEditable()
ITextViewerisEditable in interface ITextViewerpublic void setEditable(boolean editable)
ITextViewersetEditable in interface ITextViewereditable - the editable statepublic void setDefaultPrefixes(String[] defaultPrefixes, String contentType)
ITextViewersetDefaultPrefixes in interface ITextViewerdefaultPrefixes - the prefixes to be usedcontentType - the content type for which the prefixes are specifiedpublic void setUndoManager(IUndoManager undoManager)
ITextViewersetUndoManager in interface ITextViewerundoManager - the new undo manager. null is a valid argument.public IUndoManager getUndoManager()
ITextViewerExtension6getUndoManager in interface ITextViewerExtension6null if it has not been plugged-inpublic void setTextHover(ITextHover hover, String contentType)
ITextViewer
This method has been replaced by ITextViewerExtension2.setTextHover(ITextHover, String, int).
It is now equivalent to
ITextViewerExtension2 extension= (ITextViewerExtension2) document;
extension.setTextHover(textViewerHover, contentType, ITextViewerExtension2#DEFAULT_HOVER_STATE_MASK);
setTextHover in interface ITextViewerhover - the new hover. null is a valid
argument.contentType - the type for which the hover is registeredpublic void setTextHover(ITextHover hover, String contentType, int stateMask)
ITextViewerExtension2null, any hover installed for the given content type and state mask is removed.setTextHover in interface ITextViewerExtension2hover - the new hover or nullcontentType - the type for which the hover is to be registered or unregisteredstateMask - the SWT event state mask; DEFAULT_HOVER_STATE_MASK indicates that
the hover is installed as the default hover.public void removeTextHovers(String contentType)
ITextViewerExtension2
Note: To remove a hover for a given content type and state mask
use ITextViewerExtension2.setTextHover(ITextHover, String, int) with null
as parameter for the text hover.
removeTextHovers in interface ITextViewerExtension2contentType - the type for which all text hovers are to be unregisteredprotected ITextHover getTextHover(int offset)
offset - the offset for which to return the text hoverprotected ITextHover getTextHover(int offset, int stateMask)
offset - the offset for which to return the text hoverstateMask - the SWT event state maskprotected AbstractInformationControlManager getTextHoveringController()
public void setHoverControlCreator(IInformationControlCreator creator)
creator - the hover control creatorpublic boolean requestWidgetToken(IWidgetTokenKeeper requester)
IWidgetTokenOwnertrue if the token has been acquired or is already owned by
the requester. This method is non-blocking.
Replaced by
IWidgetTokenOwnerExtension.requestWidgetToken(IWidgetTokenKeeper, int).
requestWidgetToken in interface IWidgetTokenOwnerrequester - the token requestertrue if requester acquires the token,
false otherwisepublic boolean requestWidgetToken(IWidgetTokenKeeper requester, int priority)
IWidgetTokenOwnerExtensiontrue if the token has been acquired or is
already owned by the requester. This method is non-blocking.
priority is 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.
requestWidgetToken in interface IWidgetTokenOwnerExtensionrequester - the token requesterpriority - the priority of the requesttrue if requester acquires the token,
false otherwisepublic void releaseWidgetToken(IWidgetTokenKeeper tokenKeeper)
IWidgetTokenOwnerreleaseWidgetToken in interface IWidgetTokenOwnertokenKeeper - the token keeperpublic Point getSelectedRange()
ITextViewergetSelectedRange in interface ITextViewerpublic void setSelectedRange(int selectionOffset,
int selectionLength)
ITextViewersetSelectedRange in interface ITextViewerselectionOffset - the offset of the selection rangeselectionLength - the length of the selection rangeprotected void validateSelectionRange(int[] selectionRange)
[-1, -1] indicates
that the selection range could not be validated.
Subclasses may reimplement this method.selectionRange - selectionRange[0] is the offset, selectionRange[1]
the length of the selection to validate.public void setSelection(ISelection selection, boolean reveal)
ViewerSubclasses must implement this method.
setSelection in class Viewerselection - the new selectionreveal - true if the selection is to be made
visible, and false otherwisepublic ISelection getSelection()
ISelectionProvidergetSelection in interface ISelectionProvidergetSelection in class Viewerpublic ISelectionProvider getSelectionProvider()
ITextViewergetSelectionProvider in interface ITextViewerpublic void addPostSelectionChangedListener(ISelectionChangedListener listener)
IPostSelectionProvideraddPostSelectionChangedListener in interface IPostSelectionProviderlistener - a selection changed listenerpublic void removePostSelectionChangedListener(ISelectionChangedListener listener)
IPostSelectionProviderremovePostSelectionChangedListener in interface IPostSelectionProviderlistener - a selection changed listenerprotected void firePostSelectionChanged(int offset,
int length)
offset - the offset of the newly selected range in the visible documentlength - the length of the newly selected range in the visible documentprotected void selectionChanged(int offset,
int length)
offset - the offset of the newly selected range in the visible documentlength - the length of the newly selected range in the visible documentprotected void fireSelectionChanged(int offset,
int length)
offset - the offset of the newly selected range in the visible documentlength - the length of the newly selected range in the visible documentprotected void markChanged(int offset,
int length)
offset - the offset of the mark selection in the visible document, the offset is -1 if the mark was clearedlength - the length of the mark selection, may be negative if the caret is before the mark.public void addTextListener(ITextListener listener)
ITextVieweraddTextListener in interface ITextViewerlistener - the listener to be addedpublic void removeTextListener(ITextListener listener)
ITextViewerremoveTextListener in interface ITextViewerlistener - the listener to be removedprotected void updateTextListeners(TextViewer.WidgetCommand cmd)
cmd - the widget command translated into a text event sent to all text listenerspublic void addTextInputListener(ITextInputListener listener)
ITextVieweraddTextInputListener in interface ITextViewerlistener - the listener to be addedpublic void removeTextInputListener(ITextInputListener listener)
ITextViewerremoveTextInputListener in interface ITextViewerlistener - the listener to be removedprotected void fireInputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput)
oldInput - the old input documentnewInput - the new input documentprotected void fireInputDocumentChanged(IDocument oldInput, IDocument newInput)
oldInput - the old input documentnewInput - the new input documentpublic Object getInput()
IInputProvidergetInput in interface IInputProvidergetInput in class Viewerpublic IDocument getDocument()
ITextViewergetDocument in interface ITextViewerpublic void setInput(Object input)
Viewerpublic void setDocument(IDocument document)
ITextViewerTextEvent is
issued. This text event does not carry a related document event.setDocument in interface ITextViewerdocument - the viewer's new input documentpublic void setDocument(IDocument document, int modelRangeOffset, int modelRangeLength)
ITextViewerTextEvent is issued. The text event does not carry a
related document event. This method is a convenience method for
setDocument(document);setVisibleRegion(offset, length).setDocument in interface ITextViewerdocument - the new input documentmodelRangeOffset - the offset of the model rangemodelRangeLength - the length of the model rangeprotected IDocument createSlaveDocument(IDocument document)
document - the master documentprotected boolean updateVisibleDocument(IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength) throws BadLocationException
updateSlaveDocument insteadvisibleDocument - the slave documentvisibleRegionOffset - the offset of the master document rangevisibleRegionLength - the length of the master document rangetrue if the slave has been adapted successfullyBadLocationException - in case the specified range is not valid in the master documentprotected boolean updateSlaveDocument(IDocument slaveDocument, int modelRangeOffset, int modelRangeLength) throws BadLocationException
slaveDocument - the slave documentmodelRangeOffset - the offset of the master document rangemodelRangeLength - the length of the master document rangetrue if the slave has been adapted successfullyBadLocationException - in case the specified range is not valid in the master documentpublic void addViewportListener(IViewportListener listener)
ITextVieweraddViewportListener in interface ITextViewerlistener - the listener to be addedpublic void removeViewportListener(IViewportListener listener)
ITextViewerremoveViewportListener in interface ITextViewerlistener - the listener to be removedprotected void updateViewportListeners(int origin)
origin - describes under which circumstances this method has been called.IViewportListenerpublic int getTopIndex()
ITextViewergetTopIndex in interface ITextViewerpublic void setTopIndex(int index)
ITextViewersetTopIndex in interface ITextViewerindex - the line which should become the top most lineprotected int getVisibleLinesInViewport()
public int getBottomIndex()
ITextViewergetBottomIndex in interface ITextViewerpublic int getTopIndexStartOffset()
ITextViewergetTopIndexStartOffset in interface ITextViewerpublic int getBottomIndexEndOffset()
ITextViewergetBottomIndexEndOffset in interface ITextViewerpublic void revealRange(int start,
int length)
ITextViewerrevealRange in interface ITextViewerstart - the offset of the range to be revealedlength - the length of the range to be revealedprotected void internalRevealRange(int start,
int end)
start - the start offset of the rangeend - the end offset of the rangeprotected final int getWidthInPixels(String text)
getWidthInPixels(int, int) insteadtext - the string to measureprotected final IRegion getExtent(int start, int end)
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()protected final int getWidthInPixels(int offset,
int length)
offset - the offset of the text range in the visible regionlength - the length of the text range in the visible regionprotected final int getAverageCharWidth()
public void refresh()
Viewerprotected ISlaveDocumentManager getSlaveDocumentManager()
protected ISlaveDocumentManager createSlaveDocumentManager()
ChildDocumentManager.public final void invalidateTextPresentation()
ITextViewer
See ITextViewerExtension2.invalidateTextPresentation(int, int)
for a way to invalidate specific regions rather than the presentation as
a whole.
invalidateTextPresentation in interface ITextViewerpublic final void invalidateTextPresentation(int offset,
int length)
invalidateTextPresentation in interface ITextViewerExtension2offset - the offset of the range to be invalidatedlength - the length of the range to be invalidatedprotected void freeSlaveDocument(IDocument slave)
slave - the potential slave documentprotected void setVisibleDocument(IDocument document)
document - the visible documentprotected void handleVisibleDocumentAboutToBeChanged(DocumentEvent event)
Subclasses may override.
event - the document eventprotected void handleVisibleDocumentChanged(DocumentEvent event)
Subclasses may override.
event - the document eventprotected void initializeDocumentInformationMapping(IDocument visibleDocument)
visibleDocument - the slave documentprotected IDocument getVisibleDocument()
protected int _getVisibleRegionOffset()
public IRegion getVisibleRegion()
ITextViewersetVisibleRegion if
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 ITextViewerExtension5 may be forced to
change the fractions of the input document that are shown, in order to
fulfill this contract.
getVisibleRegion in interface ITextViewerpublic boolean overlapsWithVisibleRegion(int start,
int length)
ITextViewer
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.
overlapsWithVisibleRegion in interface ITextViewerstart - the offsetlength - the lengthtrue if the specified range overlaps with the
visible regionpublic void setVisibleRegion(int start,
int length)
ITextViewersetVisibleRegion in interface ITextViewerstart - the offset of the visible regionlength - the length of the visible regionpublic void resetVisibleRegion()
ITextViewerresetVisibleRegion in interface ITextViewerpublic void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType)
ITextViewersetTextDoubleClickStrategy in interface ITextViewerstrategy - the new double click strategy. null is a valid argument.contentType - the type for which the strategy is registeredprotected Object selectContentTypePlugin(int offset, Map plugins)
plugins - the map from which to chooseoffset - the offset for which to find the plug-inprotected void customizeDocumentCommand(DocumentCommand command)
VerifyEvent. The event has
been translated into a DocumentCommand which can now be
manipulated by interested parties. By default, the hook forwards the command
to the installed instances of IAutoEditStrategy.command - the document command representing the verify eventprotected void handleVerifyEvent(VerifyEvent e)
e - the verify eventVerifyListener.verifyText(VerifyEvent)public boolean canDoOperation(int operation)
ITextOperationTargetcanDoOperation in interface ITextOperationTargetoperation - the operation codetrue if the specified operation can be performedpublic void doOperation(int operation)
ITextOperationTargetdoOperation must only be called if canDoOperation
returns true.doOperation in interface ITextOperationTargetoperation - the operation codeprotected void ignoreAutoEditStrategies(boolean ignore)
ignore - true if the strategies should be ignored.protected boolean isIgnoringAutoEditStrategies()
true if the strategies are ignoredpublic void enableOperation(int operation,
boolean enable)
ITextOperationTargetExtensionenableOperation in interface ITextOperationTargetExtensionoperation - the operation to enable/disableenable - true to enable the operation otherwise falseprotected void copyMarkedRegion(boolean delete)
delete - true if the region should be deleted rather than copied.protected void deleteText()
StyledText.invokeAction insteadprotected boolean isBlockSelected()
true if a block is selectedprotected boolean areMultipleLinesSelected()
true if 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.true if one or multiple lines are selectedprotected void shift(boolean useDefaultPrefixes,
boolean right)
useDefaultPrefixes - says whether the configured default or indent prefixes should be usedright - says whether to shift to the right or the leftprotected void shift(boolean useDefaultPrefixes,
boolean right,
boolean ignoreWhitespace)
useDefaultPrefixes - says whether the configured default or indent prefixes should be usedright - says whether to shift to the right or the leftignoreWhitespace - says whether whitespace in front of prefixes is allowedprotected boolean isPrintable()
protected void print()
printContents(Printer) which
performs the actual print.protected boolean canPerformFind()
IFindReplaceTarget.canPerformFind().true if find can be performed, false otherwiseprotected int findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord)
findAndSelect(int, String, boolean, boolean, boolean, boolean)IFindReplaceTarget.findAndSelect(int, String, boolean, boolean, boolean).startPosition - the start positionfindString - the find string specificationforwardSearch - the search directioncaseSensitive - true if case sensitive, false otherwisewholeWord - true if match must be whole words, false otherwiseprotected int findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
boolean regExSearch)
IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).startPosition - the start positionfindString - the find string specificationforwardSearch - the search directioncaseSensitive - true if case sensitive, false otherwisewholeWord - true if matches must be whole words, false otherwiseregExSearch - true if findString is a regular expression, false otherwiseprotected int findAndSelectInRange(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
int rangeOffset,
int rangeLength,
boolean regExSearch)
IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).startPosition - the start positionfindString - the find string specificationforwardSearch - the search directioncaseSensitive - true if case sensitive, false otherwisewholeWord - true if matches must be whole words, false otherwiserangeOffset - the search scope offsetrangeLength - the search scope lengthregExSearch - true if findString is a regular expression, false otherwisepublic void setTextColor(Color color)
ITextViewersetTextColor in interface ITextViewercolor - the color to be appliedpublic void setTextColor(Color color, int start, int length, boolean controlRedraw)
ITextViewercontrolRedraw tells this viewer whether it
should take care of redraw management or not.setTextColor in interface ITextViewercolor - the color to be appliedstart - the offset of the range to be changedlength - the length of the range to be changedcontrolRedraw - indicates whether this viewer should manage redrawsprotected IRegion _internalGetVisibleRegion()
null.nullpublic void changeTextPresentation(TextPresentation presentation, boolean controlRedraw)
ITextViewercontrolRedraw tells 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.changeTextPresentation in interface ITextViewerpresentation - the presentation to be applied to this viewercontrolRedraw - indicates whether this viewer should manage redrawspublic IFindReplaceTarget getFindReplaceTarget()
ITextViewergetFindReplaceTarget in interface ITextViewerprotected FindReplaceDocumentAdapter getFindReplaceDocumentAdapter()
public ITextOperationTarget getTextOperationTarget()
ITextViewergetTextOperationTarget in interface ITextViewerpublic void appendVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtensionappendVerifyKeyListener in interface ITextViewerExtensionlistener - the listener to be addedpublic void prependVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtensionprependVerifyKeyListener in interface ITextViewerExtensionlistener - the listener to be insertedpublic void removeVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtensionremoveVerifyKeyListener in interface ITextViewerExtensionlistener - the listener to be removedpublic int getMark()
ITextViewerExtension-1 if the mark is not set.getMark in interface ITextViewerExtension-1 if no mark is setpublic void setMark(int offset)
ITextViewerExtension-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.setMark in interface ITextViewerExtensionoffset - the offset of the markprotected void inputChanged(Object newInput, Object oldInput)
ViewerThe 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.
inputChanged in class ViewernewInput - the new input of this viewer, or null if noneoldInput - the old input element or null if there
was previously no inputprotected void enabledRedrawing()
protected void enabledRedrawing(int topIndex)
topIndex - the top index to be set or -1protected void disableRedrawing()
public final void setRedraw(boolean redraw)
ITextViewerExtensionStyledTextwidget. While being
disconnected only the viewer's selection may be changed using
setSelectedRange. 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.setRedraw in interface ITextViewerExtensionredraw - true to enable redrawing, false
otherwiseprotected final void setRedraw(boolean redraw,
int topIndex)
ITextViewerExtension.setRedraw(boolean). Adds a way for
subclasses to pass in a desired top index that should be used when
redraw is true. If topIndex
is -1, this method is identical to
ITextViewerExtension.setRedraw(boolean).redraw - topIndex - ITextViewerExtension.setRedraw(boolean)protected final boolean redraws()
true if this viewer redraws itselfprotected final void startSequentialRewriteMode(boolean normalized)
IDocumentExtension4.startRewriteSession(DocumentRewriteSessionType) insteadnormalized - true if the rewrite is performed from the start to the end of the documentprotected final void stopSequentialRewriteMode()
IDocumentExtension4.stopRewriteSession(DocumentRewriteSession) insteadpublic IRewriteTarget getRewriteTarget()
ITextViewerExtensiongetRewriteTarget in interface ITextViewerExtensionpublic ITextHover getCurrentTextHover()
ITextViewerExtension2null otherwise.getCurrentTextHover in interface ITextViewerExtension2nullpublic Point getHoverEventLocation()
ITextViewerExtension2getHoverEventLocation in interface ITextViewerExtension2protected PaintManager getPaintManager()
public void addPainter(IPainter painter)
addPainter in interface ITextViewerExtension2painter - the painter to be addedpublic void removePainter(IPainter painter)
removePainter in interface ITextViewerExtension2painter - the painter to be removedpublic int modelLine2WidgetLine(int modelLine)
ITextViewerExtension5.modelLine2WidgetLine(int).modelLine - the model line-1public int modelOffset2WidgetOffset(int modelOffset)
ITextViewerExtension5.modelOffset2WidgetOffset(int).modelOffset - the model offset-1public IRegion modelRange2WidgetRange(IRegion modelRange)
ITextViewerExtension5.modelRange2WidgetRange(IRegion).modelRange - the model rangenullprotected IRegion modelRange2ClosestWidgetRange(IRegion modelRange)
modelRange2WidgetRange(IRegion), but more forgiving:
if modelRange describes a region entirely hidden in the
image, then this method returns the zero-length region at the offset of
the folded region.modelRange - the model rangenullpublic int widgetlLine2ModelLine(int widgetLine)
ITextViewerExtension5.widgetLine2ModelLine(int).widgetLine - the widget linepublic int widgetLine2ModelLine(int widgetLine)
ITextViewerExtension5.widgetLine2ModelLine(int).widgetLine - the widget line-1public int widgetOffset2ModelOffset(int widgetOffset)
ITextViewerExtension5.widgetOffset2ModelOffset(int).widgetOffset - the widget offset-1public IRegion widgetRange2ModelRange(IRegion widgetRange)
ITextViewerExtension5.widgetRange2ModelRange(IRegion).widgetRange - the widget rangenullpublic IRegion getModelCoverage()
ITextViewerExtension5.getModelCoverage().protected int getClosestWidgetLineForModelLine(int modelLine)
-1.modelLine - the line in the viewer's document-1protected StyleRange modelStyleRange2WidgetStyleRange(StyleRange range)
null.range - the style range in the coordinates of the viewer's documentnullprotected IRegion modelRange2WidgetRange(Position modelPosition)
modelRange2WidgetRange(IRegion) just for a Position.modelPosition - the position describing a range in the viewer's documentprotected IRegion event2ModelRange(VerifyEvent event)
event - the verify eventprotected Point widgetSelection2ModelSelection(Point widgetSelection)
null if this fails.widgetSelection - the widget selectionnullprotected Point modelSelection2WidgetSelection(Point modelSelection)
null of this fails.modelSelection - the selection range of the viewer's documentnullpublic int widgetLineOfWidgetOffset(int widgetOffset)
ITextViewerExtension5.widgetLineOfWidgetOffset(int).widgetOffset - the widget offset-1public boolean moveFocusToWidgetToken()
ITextViewerExtension4IWidgetTokenKeeper
currently holding the widget token to take the keyboard focus.moveFocusToWidgetToken in interface ITextViewerExtension4true if there was any
IWidgetTokenKeeper that was asked to take the
focus, false otherwisepublic void setDocumentPartitioning(String partitioning)
partitioning - the partitioning nameprotected String getDocumentPartitioning()
public void addTextPresentationListener(ITextPresentationListener listener)
ITextViewerExtension4addTextPresentationListener in interface ITextViewerExtension4listener - the text presentation listenerpublic void removeTextPresentationListener(ITextPresentationListener listener)
ITextViewerExtension4removeTextPresentationListener in interface ITextViewerExtension4listener - the text presentation listenerpublic void register(IEditingSupport helper)
IEditingSupportRegistryregister in interface IEditingSupportRegistryhelper - an editor supportpublic void unregister(IEditingSupport helper)
IEditingSupportRegistrysupport is null, nothing happens.unregister in interface IEditingSupportRegistryhelper - the helper to deregister, or nullpublic IEditingSupport[] getRegisteredSupports()
IEditingSupportRegistrygetRegisteredSupports in interface IEditingSupportRegistrynull array of currently registered editor
helperspublic void setHyperlinkDetectors(IHyperlinkDetector[] hyperlinkDetectors, int eventStateMask)
ITextViewerExtension6setHyperlinkDetectors in interface ITextViewerExtension6hyperlinkDetectors - the new array of hyperlink detectors, null
or an empty array to disable hyperlinkingeventStateMask - the SWT event state mask to activate hyperlink modepublic void setHyperlinkPresenter(IHyperlinkPresenter hyperlinkPresenter) throws IllegalStateException
This is only valid as long as the hyperlink manager hasn't been created yet.
hyperlinkPresenter - the hyperlink presenterIllegalStateException - if the hyperlink manager has already been createdGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.