Class SourceViewer
- java.lang.Object
-
- org.eclipse.jface.viewers.Viewer
-
- org.eclipse.jface.text.TextViewer
-
- org.eclipse.jface.text.source.SourceViewer
-
- All Implemented Interfaces:
IEditingSupportRegistry,ITextOperationTarget,ITextOperationTargetExtension,ITextViewer,ITextViewerExtension,ITextViewerExtension2,ITextViewerExtension4,ITextViewerExtension6,ITextViewerExtension7,ITextViewerExtension8,ITextViewerExtension9,IWidgetTokenOwner,IWidgetTokenOwnerExtension,ISourceViewer,ISourceViewerExtension,ISourceViewerExtension2,ISourceViewerExtension3,ISourceViewerExtension4,ISourceViewerExtension5,IInputProvider,IInputSelectionProvider,IPostSelectionProvider,ISelectionProvider
- Direct Known Subclasses:
ProjectionViewer,TextConsoleViewer
public class SourceViewer extends TextViewer implements ISourceViewer, ISourceViewerExtension, ISourceViewerExtension2, ISourceViewerExtension3, ISourceViewerExtension4, ISourceViewerExtension5
SWT based implementation ofISourceViewerand its extension interfaces. The same rules apply as forTextViewer. A source viewer uses anIVerticalRuleras its annotation presentation area. The vertical ruler is a small strip shown left of the viewer's text widget. A source viewer uses anIOverviewRuleras its presentation area for the annotation overview. The overview ruler is a small strip shown right of the viewer's text widget.Clients are supposed to instantiate a source viewer and subsequently to communicate with it exclusively using the
ISourceViewerand its extension interfaces.Clients may subclass this class but should expect some breakage by future releases.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSourceViewer.RulerLayoutLayout of a source viewer.-
Nested classes/interfaces inherited from class org.eclipse.jface.text.TextViewer
TextViewer.TextHoverKey, TextViewer.WidgetCommand
-
Nested classes/interfaces inherited from interface org.eclipse.jface.text.ITextViewerExtension8
ITextViewerExtension8.EnrichMode
-
-
Field Summary
Fields Modifier and Type Field Description protected static String_SELECTION_POSITION_CATEGORYPartial name of the position category to manage remembered selections.protected IAnnotationHoverfAnnotationHoverThe viewer's annotation hoverprotected IContentAssistantfContentAssistantThe viewer's content assistantprotected booleanfContentAssistantInstalledFlag indicating whether the viewer's content assistant is installed.protected IContentFormatterfContentFormatterThe viewer's content formatterprotected IInformationPresenterfInformationPresenterThe viewer's information presenterprotected IAnnotationHoverfOverviewRulerAnnotationHoverThe viewer's overview ruler annotation hoverprotected IPresentationReconcilerfPresentationReconcilerThe viewer's presentation reconcilerprotected IQuickAssistAssistantfQuickAssistAssistantThis viewer's quick assist assistant.protected booleanfQuickAssistAssistantInstalledFlag indicating whether this viewer's quick assist assistant is installed.protected IReconcilerfReconcilerThe viewer's model reconcilerprotected StringfSelectionCategoryPosition category used by the selection updaterprotected Stack<Position>fSelectionsStack of saved selections in the underlying documentprotected IPositionUpdaterfSelectionUpdaterPosition updater for saved selectionsprotected static intGAP_SIZEThe size of the gap between the vertical ruler and the text widget (value2).protected static intGAP_SIZE_1The size of the gap between the vertical ruler and the text widget (value1).protected static ObjectMODEL_ANNOTATION_MODELKey of the model annotation model inside the visual annotation model.-
Fields inherited from class org.eclipse.jface.text.TextViewer
fAutoIndentStrategies, fDefaultPrefixChars, fDoubleClickStrategies, fEventConsumer, fFindReplaceDocumentAdapter, fHoverControlCreator, fHyperlinkDetectors, fHyperlinkManager, fHyperlinkPresenter, fHyperlinkStateMask, fIgnoreAutoIndent, fIndentChars, fInformationMapping, fLastTopPixel, fMarkPosition, fPaintManager, fPartitioning, fReplaceTextPresentation, fTextHovers, fTextInputListeners, fTextListeners, fTextPresentationListeners, 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, QUICK_ASSIST
-
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
-
Fields inherited from interface org.eclipse.jface.text.ITextViewerExtension2
DEFAULT_HOVER_STATE_MASK
-
-
Constructor Summary
Constructors Constructor Description SourceViewer(Composite parent, IVerticalRuler ruler, int styles)Constructs a new source viewer.SourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles)Constructs a new source viewer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivatePlugins()Activates the installed plug-ins.voidaddVerticalRulerColumn(IVerticalRulerColumn column)Adds the give column as last column to this viewer's vertical ruler.booleancanDoOperation(int operation)Returns whether the operation specified by the given operation code can be performed.protected voidclearRememberedSelection()voidconfigure(SourceViewerConfiguration configuration)Configures the source viewer using the given configuration.protected voidcreateControl(Composite parent, int styles)Creates the viewer's SWT control.protected IFormattingContextcreateFormattingContext()Creates a new formatting context for a format operation.protected IFormattingContextcreateFormattingContext(int selectionOffset, int selectionLength)Creates a new formatting context for a format operation.protected LayoutcreateLayout()Creates the layout used for this viewer.protected IAnnotationModelcreateVisualAnnotationModel(IAnnotationModel annotationModel)Creates the visual annotation model on top of the given annotation model.protected voiddisposeVisualAnnotationModel()Disposes the visual annotation model.voiddoOperation(int operation)Performs the operation specified by the operation code on the target.voidenableOperation(int operation, boolean enable)Enables/disabled the given text operation.protected voidensureAnnotationHoverManagerInstalled()After this method has been executed the caller knows that any installed annotation hover has been installed.protected voidensureOverviewHoverManagerInstalled()After this method has been executed the caller knows that any installed overview hover has been installed.IAnnotationModelgetAnnotationModel()Returns this viewer's annotation model.ContentAssistantFacadegetContentAssistantFacade()Returns a facade for this viewer's content assistant.ControlgetControl()Returns the primary control associated with this viewer.IAnnotationHovergetCurrentAnnotationHover()Returns the currently displayed annotation hover if any,nullotherwise.IQuickAssistAssistantgetQuickAssistAssistant()Returns this viewers quick assist assistant.IQuickAssistInvocationContextgetQuickAssistInvocationContext()Returns this viewer's quick assist invocation context.IRegiongetRangeIndication()Returns the viewer's range indication.protected IVerticalRulergetVerticalRuler()Returns the vertical ruler of this viewer.IAnnotationModelgetVisualAnnotationModel()Returns the visual annotation model of this viewer.protected voidhandleDispose()Frees all resources allocated by this viewer.booleanhasCodeMiningProviders()Returnstrueif there are code mining providers andfalseotherwise.protected PointrememberSelection()Remembers and returns the current selection.voidremoveRangeIndication()Removes the viewer's range indication.voidremoveVerticalRulerColumn(IVerticalRulerColumn column)Removes the give column from this viewer's vertical ruler.protected voidrestoreSelection()Restores a previously saved selection in the document.voidsetAnnotationHover(IAnnotationHover annotationHover)Sets the annotation hover of this source viewer.voidsetCodeMiningAnnotationPainter(AnnotationPainter painter)Set theAnnotationPainterto use to draw code minings.voidsetCodeMiningProviders(org.eclipse.jface.text.codemining.ICodeMiningProvider[] codeMiningProviders)Register the code mining providers.voidsetDocument(IDocument document)Sets the given document as the text viewer's model and updates the presentation accordingly.voidsetDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength)Sets the given document as this viewer's model and exposes the specified region.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.voidsetHoverEnrichMode(ITextViewerExtension8.EnrichMode mode)Sets the hover enrich mode.voidsetOverviewRulerAnnotationHover(IAnnotationHover annotationHover)Sets the overview ruler's annotation hover of this source viewer.voidsetRangeIndication(int start, 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.voidshowAnnotationsOverview(boolean show)Shows/hides an overview representation of the annotations of the whole document of this viewer.voidunconfigure()Rolls back the configuration process of this source viewer.voidupdateCodeMinings()Update the code minings.protected voidupdateSlaveDocuments(IDocument masterDocument)Updates all slave documents of the given document.-
Methods inherited from class org.eclipse.jface.text.TextViewer
_getVisibleRegionOffset, _internalGetVisibleRegion, addPainter, addPostSelectionChangedListener, addTextInputListener, addTextListener, addTextPresentationListener, addViewportListener, appendVerifyKeyListener, areMultipleLinesSelected, canPerformFind, changeTextPresentation, copyMarkedRegion, createDocumentAdapter, createSlaveDocument, createSlaveDocumentManager, createTextWidget, customizeDocumentCommand, deleteText, disableRedrawing, enabledRedrawing, enabledRedrawing, event2ModelRange, findAndSelect, findAndSelect, findAndSelectInRange, fireInputDocumentAboutToBeChanged, fireInputDocumentChanged, firePostSelectionChanged, fireSelectionChanged, freeSlaveDocument, getAverageCharWidth, getBottomIndex, getBottomIndexEndOffset, getClosestWidgetLineForModelLine, getCurrentTextHover, getDocument, getDocumentPartitioning, getEmptySelectionChangedEventDelay, getExtent, getFindReplaceDocumentAdapter, getFindReplaceTarget, getHoverEventLocation, getInput, getLastKnownSelection, getMark, getModelCoverage, getPaintManager, getRegisteredSupports, getRewriteTarget, getSelectedRange, getSelection, getSelectionProvider, getSlaveDocumentManager, getTextHover, getTextHover, getTextHoveringController, getTextOperationTarget, getTextWidget, getTopIndex, getTopIndexStartOffset, getTopInset, getUndoManager, getVisibleDocument, getVisibleLinesInViewport, getVisibleRegion, getWidthInPixels, getWidthInPixels, handleVerifyEvent, handleVisibleDocumentAboutToBeChanged, handleVisibleDocumentChanged, ignoreAutoEditStrategies, initializeDocumentInformationMapping, inputChanged, internalRevealRange, invalidateTextPresentation, invalidateTextPresentation, isBlockSelected, isEditable, isIgnoringAutoEditStrategies, isPrintable, markChanged, modelLine2WidgetLine, modelOffset2WidgetOffset, modelRange2ClosestWidgetRange, modelRange2WidgetRange, modelRange2WidgetRange, modelSelection2WidgetSelection, modelStyleRange2WidgetStyleRange, moveFocusToWidgetToken, overlapsWithVisibleRegion, prependAutoEditStrategy, prependVerifyKeyListener, print, print, redraws, refresh, register, releaseWidgetToken, removeAutoEditStrategy, removePainter, removePostSelectionChangedListener, removeTextHovers, removeTextInputListener, removeTextListener, removeTextPresentationListener, removeVerifyKeyListener, removeViewportListener, requestWidgetToken, requestWidgetToken, resetPlugins, resetVisibleRegion, revealRange, selectContentTypePlugin, selectionChanged, setAutoEditStrategies, setAutoIndentStrategy, setDefaultPrefixes, setDocumentPartitioning, setEditable, setEventConsumer, setHoverControlCreator, setHyperlinkDetectors, setHyperlinkPresenter, setIndentPrefixes, setInput, setMark, setRedraw, setRedraw, setSelectedRange, setSelection, setTabsToSpacesConverter, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTextHover, setTopIndex, setUndoManager, setVisibleDocument, setVisibleRegion, shift, shift, startSequentialRewriteMode, stopSequentialRewriteMode, unregister, updateSlaveDocument, updateTextListeners, updateViewportListeners, updateVisibleDocument, validateSelectionRange, widgetLine2ModelLine, widgetLineOfWidgetOffset, widgetlLine2ModelLine, widgetOffset2ModelOffset, widgetRange2ModelRange, widgetSelection2ModelSelection
-
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
-
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
-
Methods inherited from interface org.eclipse.jface.text.ITextViewer
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, setEditable, setEventConsumer, setIndentPrefixes, setSelectedRange, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTopIndex, setUndoManager, setVisibleRegion
-
-
-
-
Field Detail
-
GAP_SIZE
protected static final int GAP_SIZE
The size of the gap between the vertical ruler and the text widget (value2).Note: As of 3.2, the text editor framework is no longer using 2 as gap but 1, see {
GAP_SIZE_1.- See Also:
- Constant Field Values
-
GAP_SIZE_1
protected static final int GAP_SIZE_1
The size of the gap between the vertical ruler and the text widget (value1).- Since:
- 3.2
- See Also:
- Constant Field Values
-
_SELECTION_POSITION_CATEGORY
protected static final String _SELECTION_POSITION_CATEGORY
Partial name of the position category to manage remembered selections.- Since:
- 3.0
- See Also:
- Constant Field Values
-
MODEL_ANNOTATION_MODEL
protected static final Object MODEL_ANNOTATION_MODEL
Key of the model annotation model inside the visual annotation model.- Since:
- 3.0
-
fContentAssistant
protected IContentAssistant fContentAssistant
The viewer's content assistant
-
fContentAssistantInstalled
protected boolean fContentAssistantInstalled
Flag indicating whether the viewer's content assistant is installed.- Since:
- 2.0
-
fQuickAssistAssistant
protected IQuickAssistAssistant fQuickAssistAssistant
This viewer's quick assist assistant.- Since:
- 3.2
-
fQuickAssistAssistantInstalled
protected boolean fQuickAssistAssistantInstalled
Flag indicating whether this viewer's quick assist assistant is installed.- Since:
- 3.2
-
fContentFormatter
protected IContentFormatter fContentFormatter
The viewer's content formatter
-
fReconciler
protected IReconciler fReconciler
The viewer's model reconciler
-
fPresentationReconciler
protected IPresentationReconciler fPresentationReconciler
The viewer's presentation reconciler
-
fAnnotationHover
protected IAnnotationHover fAnnotationHover
The viewer's annotation hover
-
fSelections
protected final Stack<Position> fSelections
Stack of saved selections in the underlying document- Since:
- 3.0
-
fSelectionUpdater
protected IPositionUpdater fSelectionUpdater
Position updater for saved selections- Since:
- 3.0
-
fSelectionCategory
protected String fSelectionCategory
Position category used by the selection updater- Since:
- 3.0
-
fOverviewRulerAnnotationHover
protected IAnnotationHover fOverviewRulerAnnotationHover
The viewer's overview ruler annotation hover- Since:
- 3.0
-
fInformationPresenter
protected IInformationPresenter fInformationPresenter
The viewer's information presenter- Since:
- 2.0
-
-
Constructor Detail
-
SourceViewer
public SourceViewer(Composite parent, IVerticalRuler ruler, int styles)
Constructs a new source viewer. The vertical ruler is initially visible. The viewer has not yet been initialized with a source viewer configuration.- Parameters:
parent- the parent of the viewer's controlruler- the vertical ruler used by this source viewerstyles- the SWT style bits for the viewer's control, ifSWT.WRAPis set then a custom document adapter needs to be provided, seeTextViewer.createDocumentAdapter()
-
SourceViewer
public SourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean showAnnotationsOverview, int styles)
Constructs a new source viewer. The vertical ruler is initially visible. The overview ruler visibility is controlled by the value ofshowAnnotationsOverview. The viewer has not yet been initialized with a source viewer configuration.- Parameters:
parent- the parent of the viewer's controlverticalRuler- the vertical ruler used by this source vieweroverviewRuler- the overview rulershowAnnotationsOverview-trueif the overview ruler should be visible,falseotherwisestyles- the SWT style bits for the viewer's control, ifSWT.WRAPis set then a custom document adapter needs to be provided, seeTextViewer.createDocumentAdapter()- Since:
- 2.1
-
-
Method Detail
-
createControl
protected void createControl(Composite parent, int styles)
Description copied from class:TextViewerCreates the viewer's SWT control. The viewer's text widget either is the control or is a child of the control.- Overrides:
createControlin classTextViewer- Parameters:
parent- the parent of the viewer's controlstyles- the SWT style bits for the viewer's control
-
createLayout
protected Layout createLayout()
Creates the layout used for this viewer. Subclasses may override this method.- Returns:
- the layout used for this viewer
- Since:
- 3.0
-
getControl
public Control getControl()
Description copied from class:ViewerReturns the primary control associated with this viewer.- Specified by:
getControlin interfaceITextViewerExtension- Overrides:
getControlin classTextViewer- Returns:
- the SWT control which displays this viewer's content
-
setAnnotationHover
public void setAnnotationHover(IAnnotationHover annotationHover)
Description copied from interface:ISourceViewerSets 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.- Specified by:
setAnnotationHoverin interfaceISourceViewer- Parameters:
annotationHover- the hover to be used,nullis a valid argument
-
setOverviewRulerAnnotationHover
public void setOverviewRulerAnnotationHover(IAnnotationHover annotationHover)
Sets the overview ruler's annotation hover of this source viewer. The annotation hover provides the information to be displayed in a hover popup window if requested over the overview rulers area. The annotation hover is assumed to be line oriented.- Parameters:
annotationHover- the hover to be used,nullis a valid argument- Since:
- 3.0
-
configure
public void configure(SourceViewerConfiguration configuration)
Description copied from interface:ISourceViewerConfigures 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().- Specified by:
configurein interfaceISourceViewer- Parameters:
configuration- the source viewer configuration to be used
-
ensureAnnotationHoverManagerInstalled
protected void ensureAnnotationHoverManagerInstalled()
After this method has been executed the caller knows that any installed annotation hover has been installed.
-
ensureOverviewHoverManagerInstalled
protected void ensureOverviewHoverManagerInstalled()
After this method has been executed the caller knows that any installed overview hover has been installed.
-
setHoverEnrichMode
public void setHoverEnrichMode(ITextViewerExtension8.EnrichMode mode)
Description copied from class:TextViewerSets the hover enrich mode. A non-nullmodedefines when hovers should be enriched once the mouse is moved into them. Ifmodeisnull, hovers are automatically closed when the mouse is moved out of thehover region.Note that a hover can only be enriched if its
IInformationControlExtension5.getInformationPresenterControlCreator()is notnull.- Specified by:
setHoverEnrichModein interfaceITextViewerExtension8- Overrides:
setHoverEnrichModein classTextViewer- Parameters:
mode- the enrich mode, ornull
-
activatePlugins
public void activatePlugins()
Description copied from interface:ITextViewerActivates the installed plug-ins. If the plug-ins are already activated this call has no effect.- Specified by:
activatePluginsin interfaceITextViewer- Overrides:
activatePluginsin classTextViewer
-
setDocument
public void setDocument(IDocument document)
Description copied from interface:ITextViewerSets the given document as the text viewer's model and updates the presentation accordingly. An appropriateTextEventis issued. This text event does not carry a related document event.- Specified by:
setDocumentin interfaceITextViewer- Overrides:
setDocumentin classTextViewer- Parameters:
document- the viewer's new input documentnullif none
-
setDocument
public void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength)
Description copied from interface:ITextViewerSets the given document as this viewer's model and exposes the specified region. An appropriateTextEventis issued. The text event does not carry a related document event. This method is a convenience method forsetDocument(document);setVisibleRegion(offset, length).- Specified by:
setDocumentin interfaceITextViewer- Overrides:
setDocumentin classTextViewer- Parameters:
document- the new input document ornullif nonevisibleRegionOffset- the offset of the model rangevisibleRegionLength- the length of the model range
-
setDocument
public void setDocument(IDocument document, IAnnotationModel annotationModel)
Description copied from interface:ISourceViewerSets 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.- Specified by:
setDocumentin interfaceISourceViewer- Parameters:
document- the viewer's new input documentannotationModel- the model for the viewer's visual annotations- See Also:
ITextViewer.setDocument(IDocument)
-
createVisualAnnotationModel
protected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel)
Creates the visual annotation model on top of the given annotation model.- Parameters:
annotationModel- the wrapped annotation model- Returns:
- the visual annotation model on top of the given annotation model
- Since:
- 3.0
-
disposeVisualAnnotationModel
protected void disposeVisualAnnotationModel()
Disposes the visual annotation model.- Since:
- 3.1
-
setDocument
public void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength)
Description copied from interface:ISourceViewerSets 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).- Specified by:
setDocumentin interfaceISourceViewer- Parameters:
document- the new input documentannotationModel- the model of the viewer's visual annotationsmodelRangeOffset- the offset of the model rangemodelRangeLength- the length of the model range- See Also:
ITextViewer.setDocument(IDocument, int, int)
-
getAnnotationModel
public IAnnotationModel getAnnotationModel()
Description copied from interface:ISourceViewerReturns this viewer's annotation model. UseISourceViewerExtension2.getVisualAnnotationModel()in order to get access to the viewer's visual annotation model.- Specified by:
getAnnotationModelin interfaceISourceViewer- Returns:
- this viewer's annotation model, or
nullif none could be determined
-
getQuickAssistAssistant
public IQuickAssistAssistant getQuickAssistAssistant()
Description copied from interface:ISourceViewerExtension3Returns this viewers quick assist assistant.- Specified by:
getQuickAssistAssistantin interfaceISourceViewerExtension3- Returns:
- the quick assist assistant or
nullif none is configured
-
getContentAssistantFacade
public final ContentAssistantFacade getContentAssistantFacade()
Returns a facade for this viewer's content assistant.- Specified by:
getContentAssistantFacadein interfaceISourceViewerExtension4- Returns:
- a content assistant facade or
nullif none is configured - Since:
- 3.4
-
getQuickAssistInvocationContext
public IQuickAssistInvocationContext getQuickAssistInvocationContext()
Description copied from interface:ISourceViewerExtension3Returns this viewer's quick assist invocation context.- Specified by:
getQuickAssistInvocationContextin interfaceISourceViewerExtension3- Returns:
- the quick assist invocation context or
nullif none is available
-
getVisualAnnotationModel
public IAnnotationModel getVisualAnnotationModel()
Description copied from interface:ISourceViewerExtension2Returns the visual annotation model of this viewer.- Specified by:
getVisualAnnotationModelin interfaceISourceViewerExtension2- Returns:
- the visual annotation model of this viewer
-
unconfigure
public void unconfigure()
Description copied from interface:ISourceViewerExtension2Rolls back the configuration process of this source viewer. The source viewer can be configured again after a call to this method. UnlikeISourceViewer.configure(SourceViewerConfiguration)this method can be called more than once without interleaving calls toISourceViewer.configure(SourceViewerConfiguration).- Specified by:
unconfigurein interfaceISourceViewerExtension2
-
handleDispose
protected void handleDispose()
Description copied from class:TextViewerFrees all resources allocated by this viewer. Internally called when the viewer's control has been disposed.- Overrides:
handleDisposein classTextViewer
-
canDoOperation
public boolean canDoOperation(int operation)
Description copied from interface:ITextOperationTargetReturns whether the operation specified by the given operation code can be performed.- Specified by:
canDoOperationin interfaceITextOperationTarget- Overrides:
canDoOperationin classTextViewer- Parameters:
operation- the operation code- Returns:
trueif the specified operation can be performed
-
createFormattingContext
protected IFormattingContext createFormattingContext()
Creates a new formatting context for a format operation.After the use of the context, clients are required to call its
disposemethod.- Returns:
- The new formatting context
- Since:
- 3.0
-
createFormattingContext
protected IFormattingContext createFormattingContext(int selectionOffset, int selectionLength)
Creates a new formatting context for a format operation. If the returned context has theFormattingContextProperties.CONTEXT_REGIONproperty set to anIRegion, the section of the document defined by that region is formatted, otherwise the whole document is formatted.The default implementation calls
createFormattingContext()and sets theFormattingContextProperties.CONTEXT_REGIONproperty if the selection is not empty. Overriding methods may implement a different logic, or returnnullto indicate that the formatting operation should not proceed.Returning
nullmay be used, for example, when the user clicks on the Cancel button in a dialog that, in case of an empty selection, asks the user whether formatting should be applied to the whole document or to the current statement. Please notice that returningnullfrom this method cancels the already initiated formatting operation unlikecanDoOperation(int), which is used for enabling and disabling formatting actions.After the use of the context, clients are required to call its
disposemethod.- Parameters:
selectionOffset- the character offset of the selection in the documentselectionLength- the length of the selection- Returns:
- The new formatting context, or
nullto cancel the formatting - Since:
- 3.10
-
rememberSelection
protected Point rememberSelection()
Remembers and returns the current selection. The saved selection can be restored by callingrestoreSelection().- Returns:
- the current selection
- Since:
- 3.0
- See Also:
ITextViewer.getSelectedRange()
-
restoreSelection
protected void restoreSelection()
Restores a previously saved selection in the document.If no selection was previously saved, nothing happens.
- Since:
- 3.0
-
clearRememberedSelection
protected void clearRememberedSelection()
-
doOperation
public void doOperation(int operation)
Description copied from interface:ITextOperationTargetPerforms the operation specified by the operation code on the target.doOperationmust only be called ifcanDoOperationreturnstrue.- Specified by:
doOperationin interfaceITextOperationTarget- Overrides:
doOperationin classTextViewer- Parameters:
operation- the operation code
-
updateSlaveDocuments
protected void updateSlaveDocuments(IDocument masterDocument)
Updates all slave documents of the given document. This default implementation callsupdateSlaveDocumentfor their current visible range. Subclasses may reimplement.- Parameters:
masterDocument- the master document- Since:
- 3.0
-
enableOperation
public void enableOperation(int operation, boolean enable)Description copied from interface:ITextOperationTargetExtensionEnables/disabled the given text operation.- Specified by:
enableOperationin interfaceITextOperationTargetExtension- Overrides:
enableOperationin classTextViewer- Parameters:
operation- the operation to enable/disableenable-trueto enable the operation otherwisefalse
-
setRangeIndicator
public void setRangeIndicator(Annotation rangeIndicator)
Description copied from interface:ISourceViewerSets the annotation used by this viewer as range indicator. The range covered by this annotation is referred to as range indication.- Specified by:
setRangeIndicatorin interfaceISourceViewer- Parameters:
rangeIndicator- the annotation to be used as this viewer's range indicator
-
setRangeIndication
public void setRangeIndication(int start, int length, boolean moveCursor)Description copied from interface:ISourceViewerSets 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.- Specified by:
setRangeIndicationin interfaceISourceViewer- Parameters:
start- the offset of the rangelength- the length of the rangemoveCursor- indicates whether the cursor should be moved to the given offset
-
getRangeIndication
public IRegion getRangeIndication()
Description copied from interface:ISourceViewerReturns the viewer's range indication.- Specified by:
getRangeIndicationin interfaceISourceViewer- Returns:
- the viewer's range indication.
-
removeRangeIndication
public void removeRangeIndication()
Description copied from interface:ISourceViewerRemoves the viewer's range indication. There is no visible range indication after this method completed.- Specified by:
removeRangeIndicationin interfaceISourceViewer
-
showAnnotations
public void showAnnotations(boolean show)
Description copied from interface:ISourceViewerControls 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.
- Specified by:
showAnnotationsin interfaceISourceViewer- Parameters:
show- indicates the visibility of annotations
-
getVerticalRuler
protected final IVerticalRuler getVerticalRuler()
Returns the vertical ruler of this viewer.- Returns:
- the vertical ruler of this viewer
- Since:
- 3.0
-
addVerticalRulerColumn
public void addVerticalRulerColumn(IVerticalRulerColumn column)
Adds the give column as last column to this viewer's vertical ruler.- Parameters:
column- the column to be added- Since:
- 3.8
-
removeVerticalRulerColumn
public void removeVerticalRulerColumn(IVerticalRulerColumn column)
Removes the give column from this viewer's vertical ruler.- Parameters:
column- the column to be removed- Since:
- 3.8
-
showAnnotationsOverview
public void showAnnotationsOverview(boolean show)
Description copied from interface:ISourceViewerExtensionShows/hides an overview representation of the annotations of the whole document of this viewer.- Specified by:
showAnnotationsOverviewin interfaceISourceViewerExtension- Parameters:
show-trueif annotation overview should be visible,falseotherwise
-
getCurrentAnnotationHover
public IAnnotationHover getCurrentAnnotationHover()
Description copied from interface:ISourceViewerExtension3Returns the currently displayed annotation hover if any,nullotherwise.- Specified by:
getCurrentAnnotationHoverin interfaceISourceViewerExtension3- Returns:
- the currently displayed annotation hover or
null
-
setCodeMiningProviders
public void setCodeMiningProviders(org.eclipse.jface.text.codemining.ICodeMiningProvider[] codeMiningProviders)
Description copied from interface:ISourceViewerExtension5Register the code mining providers.- Specified by:
setCodeMiningProvidersin interfaceISourceViewerExtension5- Parameters:
codeMiningProviders- the code mining providers to register.
-
hasCodeMiningProviders
public boolean hasCodeMiningProviders()
Description copied from interface:ISourceViewerExtension5Returnstrueif there are code mining providers andfalseotherwise.- Specified by:
hasCodeMiningProvidersin interfaceISourceViewerExtension5- Returns:
trueif there are code mining providers andfalseotherwise.
-
updateCodeMinings
public void updateCodeMinings()
Description copied from interface:ISourceViewerExtension5Update the code minings. Clients and implementors are responsible of calling this method when needed. A typical use-case can be to run it upon completion of a reconcilier and after a job that would compute all the necessary pre-requisites to insert code mining annotations.- Specified by:
updateCodeMiningsin interfaceISourceViewerExtension5
-
setCodeMiningAnnotationPainter
public void setCodeMiningAnnotationPainter(AnnotationPainter painter)
Description copied from interface:ISourceViewerExtension5Set theAnnotationPainterto use to draw code minings.- Specified by:
setCodeMiningAnnotationPainterin interfaceISourceViewerExtension5- Parameters:
painter- theAnnotationPainterto use to draw code minings.
-
-