public interface ISourceViewer extends ITextViewer
As the visibility of visual annotations can dynamically be changed, it is assumed that the annotation presentation area can dynamically be hidden if it is different from the text widget.
In order to provide backward compatibility for clients of
ISourceViewer
, extension interfaces are used as a means of
evolution. The following extension interfaces exist:
ISourceViewerExtension
since version 2.1
introducing the concept of an annotation overview.ISourceViewerExtension2
since version 3.0
allowing source viewers to roll back a previously performed configuration and
allows access to the viewer's visual annotation model.ISourceViewerExtension3
since version 3.2
introducing the concept of a quick assist assistant and providing access
to the quick assist invocation context as well as the current annotation hover.ISourceViewerExtension4
since version 3.4
introducing API to access a minimal set of content assistant APIs.
Clients may implement this interface and its extension interfaces or use the
default implementation provided by
SourceViewer
.
Modifier and Type | Field and Description |
---|---|
static int |
CONTENTASSIST_CONTEXT_INFORMATION
Text operation code for requesting content assist to show
the content information for the current insert position.
|
static int |
CONTENTASSIST_PROPOSALS
Text operation code for requesting content assist to show completion
proposals for the current insert position.
|
static int |
FORMAT
Text operation code for formatting the selected text or complete document
of this viewer if the selection is empty.
|
static int |
INFORMATION
Text operation code for requesting information at the current insertion position.
|
static int |
QUICK_ASSIST
Text operation code for requesting quick assist.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(SourceViewerConfiguration configuration)
Configures the source viewer using the given configuration.
|
IAnnotationModel |
getAnnotationModel()
Returns this viewer's annotation model.
|
IRegion |
getRangeIndication()
Returns the viewer's range indication.
|
void |
removeRangeIndication()
Removes the viewer's range indication.
|
void |
setAnnotationHover(IAnnotationHover annotationHover)
Sets the annotation hover of this source viewer.
|
void |
setDocument(IDocument document,
IAnnotationModel annotationModel)
Sets the given document as this viewer's text model and the
given annotation model as the model for this viewer's visual
annotations.
|
void |
setDocument(IDocument document,
IAnnotationModel annotationModel,
int modelRangeOffset,
int modelRangeLength)
Sets the given document as this viewer's text model and the
given annotation model as the model for this viewer's visual
annotations.
|
void |
setRangeIndication(int offset,
int length,
boolean moveCursor)
Sets the viewers's range indication to the specified range.
|
void |
setRangeIndicator(Annotation rangeIndicator)
Sets the annotation used by this viewer as range indicator.
|
void |
showAnnotations(boolean show)
Controls the visibility of annotations and in the case of separate
presentation areas of text and annotations, the visibility of the
annotation's presentation area.
|
activatePlugins, addTextInputListener, addTextListener, addViewportListener, changeTextPresentation, getBottomIndex, getBottomIndexEndOffset, getDocument, getFindReplaceTarget, getSelectedRange, getSelectionProvider, getTextOperationTarget, getTextWidget, getTopIndex, getTopIndexStartOffset, getTopInset, getVisibleRegion, invalidateTextPresentation, isEditable, overlapsWithVisibleRegion, removeTextInputListener, removeTextListener, removeViewportListener, resetPlugins, resetVisibleRegion, revealRange, setAutoIndentStrategy, setDefaultPrefixes, setDocument, setDocument, setEditable, setEventConsumer, setIndentPrefixes, setSelectedRange, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTopIndex, setUndoManager, setVisibleRegion
static final int CONTENTASSIST_PROPOSALS
static final int CONTENTASSIST_CONTEXT_INFORMATION
static final int FORMAT
static final int INFORMATION
static final int QUICK_ASSIST
void configure(SourceViewerConfiguration configuration)
ISourceViewerExtension2.unconfigure()
.configuration
- the source viewer configuration to be usedvoid setAnnotationHover(IAnnotationHover annotationHover)
annotationHover
- the hover to be used, null
is a valid argumentvoid setDocument(IDocument document, IAnnotationModel annotationModel)
TextEvent
is issued. This text event does not carry
a related document event.document
- the viewer's new input documentannotationModel
- the model for the viewer's visual annotationsITextViewer.setDocument(IDocument)
void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength)
TextEvent
is issued. The text event does not carry a
related document event. This method is a convenience method for
setDocument(document, annotationModel);setVisibleRegion(offset, length)
.document
- the new input documentannotationModel
- the model of the viewer's visual annotationsmodelRangeOffset
- the offset of the model rangemodelRangeLength
- the length of the model rangeITextViewer.setDocument(IDocument, int, int)
IAnnotationModel getAnnotationModel()
ISourceViewerExtension2.getVisualAnnotationModel()
in order to
get access to the viewer's visual annotation model.void setRangeIndicator(Annotation rangeIndicator)
rangeIndicator
- the annotation to be used as this viewer's range indicatorvoid setRangeIndication(int offset, int length, boolean moveCursor)
offset
- the offset of the rangelength
- the length of the rangemoveCursor
- indicates whether the cursor should be moved to the given offsetIRegion getRangeIndication()
void removeRangeIndication()
void showAnnotations(boolean show)
By default, annotations and their presentation area are visible.
show
- indicates the visibility of annotations
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.