Package org.eclipse.jface.text.source
Interface ISourceViewer
- All Superinterfaces:
- ITextViewer
- All Known Implementing Classes:
- ProjectionViewer,- SourceViewer,- TextConsoleViewer
In addition to the text viewer functionality a source viewer supports:
 
- visual annotations based on an annotation model
- visual range indication
- management of text viewer add-ons
- explicit configuration
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:
 
- ISourceViewerExtensionsince version 2.1 introducing the concept of an annotation overview.
- ISourceViewerExtension2since version 3.0 allowing source viewers to roll back a previously performed configuration and allows access to the viewer's visual annotation model.
- ISourceViewerExtension3since 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.
- ISourceViewerExtension4since version 3.4 introducing API to access a minimal set of content assistant APIs.
- ISourceViewerExtension5since version 3.13 introducing API to access minimal set of code mining APIs.
 Clients may implement this interface and its extension interfaces or use the default
 implementation provided by SourceViewer.
 
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intText operation code for requesting content assist to show the content information for the current insert position.static final intText operation code for requesting content assist to show completion proposals for the current insert position.static final intText operation code for formatting the selected text or complete document of this viewer if the selection is empty.static final intText operation code for requesting information at the current insertion position.static final intText operation code for requesting quick assist.
- 
Method SummaryModifier and TypeMethodDescriptionvoidconfigure(SourceViewerConfiguration configuration) Configures the source viewer using the given configuration.Returns this viewer's annotation model.Returns the viewer's range indication.voidRemoves the viewer's range indication.voidsetAnnotationHover(IAnnotationHover annotationHover) Sets the annotation hover of this source viewer.voidsetDocument(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.voidsetDocument(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.voidsetRangeIndication(int offset, int length, boolean moveCursor) Sets the viewers's range indication to the specified range.voidsetRangeIndicator(Annotation rangeIndicator) Sets the annotation used by this viewer as range indicator.voidshowAnnotations(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.Methods inherited from interface org.eclipse.jface.text.ITextVieweractivatePlugins, 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
- 
Field Details- 
CONTENTASSIST_PROPOSALSstatic final int CONTENTASSIST_PROPOSALSText operation code for requesting content assist to show completion proposals for the current insert position.- See Also:
 
- 
CONTENTASSIST_CONTEXT_INFORMATIONstatic final int CONTENTASSIST_CONTEXT_INFORMATIONText operation code for requesting content assist to show the content information for the current insert position.- See Also:
 
- 
FORMATstatic final int FORMATText operation code for formatting the selected text or complete document of this viewer if the selection is empty.- See Also:
 
- 
INFORMATIONstatic final int INFORMATIONText operation code for requesting information at the current insertion position.- Since:
- 2.0
- See Also:
 
- 
QUICK_ASSISTstatic final int QUICK_ASSISTText operation code for requesting quick assist. This will normally show quick assist and quick fix proposals for the current position.- Since:
- 3.2
- See Also:
 
 
- 
- 
Method Details- 
configureConfigures the source viewer using the given configuration. Prior to 3.0 this method can only be called once. Since 3.0 this method can be called again after a call toISourceViewerExtension2.unconfigure().- Parameters:
- configuration- the source viewer configuration to be used
 
- 
setAnnotationHoverSets the annotation hover of this source viewer. The annotation hover provides the information to be displayed in a hover popup window if requested over the annotation presentation area. The annotation hover is assumed to be line oriented.- Parameters:
- annotationHover- the hover to be used,- nullis a valid argument
 
- 
setDocumentSets the given document as this viewer's text model and the given annotation model as the model for this viewer's visual annotations. The presentation is accordingly updated. An appropriateTextEventis issued. This text event does not carry a related document event.- Parameters:
- document- the viewer's new input document
- annotationModel- the model for the viewer's visual annotations
- See Also:
 
- 
setDocumentvoid 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. The presentation is accordingly updated whereby only the specified region is exposed. An appropriateTextEventis issued. The text event does not carry a related document event. This method is a convenience method forsetDocument(document, annotationModel);setVisibleRegion(offset, length).- Parameters:
- document- the new input document
- annotationModel- the model of the viewer's visual annotations
- modelRangeOffset- the offset of the model range
- modelRangeLength- the length of the model range
- See Also:
 
- 
getAnnotationModelIAnnotationModel getAnnotationModel()Returns this viewer's annotation model. UseISourceViewerExtension2.getVisualAnnotationModel()in order to get access to the viewer's visual annotation model.- Returns:
- this viewer's annotation model, or nullif none could be determined
 
- 
setRangeIndicatorSets the annotation used by this viewer as range indicator. The range covered by this annotation is referred to as range indication.- Parameters:
- rangeIndicator- the annotation to be used as this viewer's range indicator
 
- 
setRangeIndicationvoid setRangeIndication(int offset, int length, boolean moveCursor) Sets the viewers's range indication to the specified range. It is indicated whether the cursor should also be moved to the beginning of the specified range.- Parameters:
- offset- the offset of the range
- length- the length of the range
- moveCursor- indicates whether the cursor should be moved to the given offset
 
- 
getRangeIndicationIRegion getRangeIndication()Returns the viewer's range indication.- Returns:
- the viewer's range indication.
 
- 
removeRangeIndicationvoid removeRangeIndication()Removes the viewer's range indication. There is no visible range indication after this method completed.
- 
showAnnotationsvoid 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.By default, annotations and their presentation area are visible. - Parameters:
- show- indicates the visibility of annotations
 
 
-