|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.viewers.Viewer | +--org.eclipse.jface.text.TextViewer | +--org.eclipse.jface.text.source.SourceViewer
SWT based implementation of ISourceViewer
. The same rules apply
as for TextViewer
. A source viewer uses an IVerticalRuler
as its annotation presentation area. The vertical ruler is a small strip shown left
of the viewer's text widget.
Clients are supposed to instantiate a source viewer and subsequently to communicate
with it exclusively using the ISourceViewer
interface. Clients should not
subclass this class as it is rather likely that subclasses will be broken by future releases.
Nested Class Summary |
Nested classes inherited from class org.eclipse.jface.text.TextViewer |
TextViewer.WidgetCommand |
Field Summary | |
protected IAnnotationHover |
fAnnotationHover
The viewer's annotation hover |
protected IContentAssistant |
fContentAssistant
The viewer's content assistant |
protected boolean |
fContentAssistantInstalled
Flag indicating whether the viewer's content assistant is installed |
protected IContentFormatter |
fContentFormatter
The viewer's content formatter |
protected IInformationPresenter |
fInformationPresenter
The viewer's information presenter |
protected IPresentationReconciler |
fPresentationReconciler
The viewer's presentation reconciler |
protected IReconciler |
fReconciler
The viewer's model reconciler |
protected static int |
GAP_SIZE
The size of the gap between the vertical ruler and the text widget |
Fields inherited from class org.eclipse.jface.text.TextViewer |
fAutoIndentStrategies, fDefaultPrefixChars, fDoubleClickStrategies, fEventConsumer, fHoverControlCreator, fIgnoreAutoIndent, fIndentChars, fLastTopPixel, fReplaceTextPresentation, fTextHovers, fTextInputListeners, fTextListeners, fUndoManager, fViewportListeners, INTERNAL, KEY, MOUSE, MOUSE_END, RESIZE, SCROLLER, SHIFTING, TRACE_ERRORS |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
WIDGET_DATA_KEY |
Fields inherited from interface org.eclipse.jface.text.source.ISourceViewer |
CONTENTASSIST_CONTEXT_INFORMATION, CONTENTASSIST_PROPOSALS, FORMAT, INFORMATION |
Fields inherited from interface org.eclipse.jface.text.ITextOperationTarget |
COPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDO |
Constructor Summary | |
SourceViewer(Composite parent,
IVerticalRuler ruler,
int styles)
Constructs a new source viewer. |
Method Summary | |
void |
activatePlugins()
Activates the installed plug-ins. |
boolean |
canDoOperation(int operation)
Returns whether the operation specified by the given operation code can be performed. |
void |
configure(SourceViewerConfiguration configuration)
Configures the source viewer using the given configuration. |
protected void |
createControl(Composite parent,
int styles)
Creates the viewer's SWT control. |
void |
doOperation(int operation)
Performs the operation specified by the operation code on the target. |
void |
enableOperation(int operation,
boolean enable)
Enables/disabled the given text operation. |
IAnnotationModel |
getAnnotationModel()
Returns this viewer's annotation model. |
Control |
getControl()
Returns the control of this viewer. |
IRegion |
getRangeIndication()
Returns the viewer's range indication. |
protected void |
handleDispose()
Frees all resources allocated by this viewer. |
void |
removeRangeIndication()
Removes the viewer's range indication. |
void |
setAnnotationHover(IAnnotationHover annotationHover)
Sets the annotation hover of this source viewer. |
void |
setDocument(IDocument document)
Sets the given document as the text viewer's model and updates the presentation accordingly. |
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 |
setDocument(IDocument document,
int visibleRegionOffset,
int visibleRegionLength)
Sets the given document as this viewer's model and makes the specified region visible in the presentation. |
void |
setRangeIndication(int start,
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 class org.eclipse.jface.viewers.Viewer |
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected IContentAssistant fContentAssistant
protected boolean fContentAssistantInstalled
protected IContentFormatter fContentFormatter
protected IReconciler fReconciler
protected IPresentationReconciler fPresentationReconciler
protected IAnnotationHover fAnnotationHover
protected IInformationPresenter fInformationPresenter
protected static final int GAP_SIZE
Constructor Detail |
public SourceViewer(Composite parent, IVerticalRuler ruler, int styles)
parent
- the parent of the viewer's controlruler
- the vertical ruler used by this source viewerstyles
- the SWT style bitsMethod Detail |
protected void createControl(Composite parent, int styles)
TextViewer
createControl
in class TextViewer
parent
- the parent of the viewer's controlstyles
- the SWT style bits for the viewer's controlpublic Control getControl()
ITextViewerExtension
getControl
in interface ITextViewerExtension
getControl
in class TextViewer
public void setAnnotationHover(IAnnotationHover annotationHover)
ISourceViewer
setAnnotationHover
in interface ISourceViewer
annotationHover
- the hover to be used, null
is a valid argumentpublic void configure(SourceViewerConfiguration configuration)
ISourceViewer
configure
in interface ISourceViewer
configuration
- the source viewer configuration to be usedpublic void activatePlugins()
ITextViewer
activatePlugins
in interface ITextViewer
activatePlugins
in class TextViewer
public void setDocument(IDocument document)
ITextViewer
TextEvent
is
issued. This text event does not carry a related document event.
setDocument
in interface ITextViewer
setDocument
in class TextViewer
document
- the viewer's new input documentpublic void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength)
ITextViewer
TextEvent
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 ITextViewer
setDocument
in class TextViewer
document
- the new input documentvisibleRegionOffset
- the offset of the visible regionvisibleRegionLength
- the length of the visible regionpublic void setDocument(IDocument document, IAnnotationModel annotationModel)
ISourceViewer
TextEvent
is issued. This text event does not carry
a related document event.
setDocument
in interface ISourceViewer
document
- the viewer's new input documentannotationModel
- the model for the viewer's visual annotationsITextViewer.setDocument(IDocument)
public void setDocument(IDocument document, IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength)
ISourceViewer
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)
.
setDocument
in interface ISourceViewer
document
- the new input documentannotationModel
- the model of the viewer's visual annotationsvisibleRegionOffset
- the offset of the visible regionvisibleRegionLength
- the length of the visible regionITextViewer.setDocument(IDocument, int, int)
public IAnnotationModel getAnnotationModel()
ISourceViewer
getAnnotationModel
in interface ISourceViewer
protected void handleDispose()
TextViewer
handleDispose
in class TextViewer
public boolean canDoOperation(int operation)
ITextOperationTarget
canDoOperation
in interface ITextOperationTarget
canDoOperation
in class TextViewer
operation
- the operation code
true
if the specified operation can be performedpublic void doOperation(int operation)
ITextOperationTarget
doOperation
must only be called if canDoOperation
returns true
.
doOperation
in interface ITextOperationTarget
doOperation
in class TextViewer
operation
- the operation codepublic void enableOperation(int operation, boolean enable)
ITextOperationTargetExtension
enableOperation
in interface ITextOperationTargetExtension
enableOperation
in class TextViewer
operation
- the operation to enable/disableenable
- true
to enable the operation otherwise false
public void setRangeIndicator(Annotation rangeIndicator)
ISourceViewer
setRangeIndicator
in interface ISourceViewer
rangeIndicator
- the annotation to be used as this viewer's range indicatorpublic void setRangeIndication(int start, int length, boolean moveCursor)
ISourceViewer
setRangeIndication
in interface ISourceViewer
start
- the offset of the rangelength
- the length of the rangemoveCursor
- indicates whether the cursor should be moved to the given offsetpublic IRegion getRangeIndication()
ISourceViewer
getRangeIndication
in interface ISourceViewer
public void removeRangeIndication()
ISourceViewer
removeRangeIndication
in interface ISourceViewer
public void showAnnotations(boolean show)
ISourceViewer
By default, annotations and their presentation area are visible.
showAnnotations
in interface ISourceViewer
show
- indicates the visibility of annotations
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |