Eclipse Platform
2.0

org.eclipse.jface.text.source
Interface ISourceViewer

All Superinterfaces:
ITextViewer
All Known Implementing Classes:
SourceViewer

public interface ISourceViewer
extends ITextViewer

In addition to the text viewer functionality a source viewer supports:

It is assumed that range indication and visual annotations are shown inside the same presentation area. There are no assumptions about whether this area is different from the viewer's text widget.

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.

Clients may implement this interface or use the default implementation provided by SourceViewer.


Field Summary
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 completetion 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.
 
Method Summary
 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 visibleRegionOffset, int visibleRegionLength)
          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.
 
Methods inherited from interface org.eclipse.jface.text.ITextViewer
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
 

Field Detail

CONTENTASSIST_PROPOSALS

public static final int CONTENTASSIST_PROPOSALS
Text operation code for requesting content assist to show completetion proposals for the current insert position.

See Also:
Constant Field Values

CONTENTASSIST_CONTEXT_INFORMATION

public static final int CONTENTASSIST_CONTEXT_INFORMATION
Text operation code for requesting content assist to show the content information for the current insert position.

See Also:
Constant Field Values

FORMAT

public static final int FORMAT
Text operation code for formatting the selected text or complete document of this viewer if the selection is empty.

See Also:
Constant Field Values

INFORMATION

public static final int INFORMATION
Text operation code for requesting information at the current insertion position.

Since:
2.0
See Also:
Constant Field Values
Method Detail

configure

public void configure(SourceViewerConfiguration configuration)
Configures the source viewer using the given configuration.

Parameters:
configuration - the source viewer configuration to be used

setAnnotationHover

public void setAnnotationHover(IAnnotationHover annotationHover)
Sets 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, null is a valid argument

setDocument

public 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. The presentation is accordingly updated. An approriate TextEvent is 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:
ITextViewer.setDocument(IDocument)

setDocument

public void setDocument(IDocument document,
                        IAnnotationModel annotationModel,
                        int visibleRegionOffset,
                        int visibleRegionLength)
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 made visible. An approriate 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).

Parameters:
document - the new input document
annotationModel - the model of the viewer's visual annotations
visibleRegionOffset - the offset of the visible region
visibleRegionLength - the length of the visible region
See Also:
ITextViewer.setDocument(IDocument, int, int)

getAnnotationModel

public IAnnotationModel getAnnotationModel()
Returns this viewer's annotation model.

Returns:
this viewer's annotation model

setRangeIndicator

public void setRangeIndicator(Annotation rangeIndicator)
Sets 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

setRangeIndication

public void setRangeIndication(int offset,
                               int length,
                               boolean moveCursor)
Sets the viewers's range indication to the specified range. Its 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

getRangeIndication

public IRegion getRangeIndication()
Returns the viewer's range indication.

Returns:
the viewer's range indication.

removeRangeIndication

public void removeRangeIndication()
Removes the viewer's range indication. There is no visible range indication after this method completed.

Returns:
the viewer's range indication

showAnnotations

public 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.

By default, annotations and their presentation area are visible.

Parameters:
show - indicates the visibility of annotations

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.