public class SourceViewerConfiguration extends Object
configure
method of
ISourceViewer
.
Each method in this class get as argument the source viewer for which it should provide a particular configuration setting such as a presentation reconciler. Based on its specific knowledge about the returned object, the configuration might share such objects or compute them according to some rules.
Clients should subclass and override just those methods which must be specific to their needs.
ISourceViewer
Constructor and Description |
---|
SourceViewerConfiguration()
Creates a new source viewer configuration that behaves according to
specification of this class' methods.
|
Modifier and Type | Method and Description |
---|---|
IAnnotationHover |
getAnnotationHover(ISourceViewer sourceViewer)
Returns the annotation hover which will provide the information to be
shown in a hover popup window when requested for the given
source viewer.
|
IAutoEditStrategy[] |
getAutoEditStrategies(ISourceViewer sourceViewer,
String contentType)
Returns the auto edit strategies ready to be used with the given source viewer
when manipulating text of the given content type.
|
IAutoIndentStrategy |
getAutoIndentStrategy(ISourceViewer sourceViewer,
String contentType)
Deprecated.
since 3.1 use
getAutoEditStrategies(ISourceViewer, String) instead |
String[] |
getConfiguredContentTypes(ISourceViewer sourceViewer)
Returns all configured content types for the given source viewer.
|
String |
getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
Returns the configured partitioning for the given source viewer.
|
int[] |
getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer,
String contentType)
Returns the SWT event state masks for which text hover are configured for
the given content type.
|
IContentAssistant |
getContentAssistant(ISourceViewer sourceViewer)
Returns the content assistant ready to be used with the given source viewer.
|
IContentFormatter |
getContentFormatter(ISourceViewer sourceViewer)
Returns the content formatter ready to be used with the given source viewer.
|
String[] |
getDefaultPrefixes(ISourceViewer sourceViewer,
String contentType)
Returns the default prefixes to be used by the line-prefix operation
in the given source viewer for text of the given content type.
|
ITextDoubleClickStrategy |
getDoubleClickStrategy(ISourceViewer sourceViewer,
String contentType)
Returns the double-click strategy ready to be used in this viewer when double clicking
onto text of the given content type.
|
IHyperlinkDetector[] |
getHyperlinkDetectors(ISourceViewer sourceViewer)
Returns the hyperlink detectors which be used to detect hyperlinks
in the given source viewer.
|
IHyperlinkPresenter |
getHyperlinkPresenter(ISourceViewer sourceViewer)
Returns the hyperlink presenter for the given source viewer.
|
int |
getHyperlinkStateMask(ISourceViewer sourceViewer)
Returns the SWT event state mask which in combination
with the left mouse button activates hyperlinking.
|
String[] |
getIndentPrefixes(ISourceViewer sourceViewer,
String contentType)
Returns the prefixes to be used by the line-shift operation.
|
protected String[] |
getIndentPrefixesForTab(int tabWidth)
Computes and returns the indent prefixes for tab indentation
which is represented as
tabSizeInSpaces . |
IInformationControlCreator |
getInformationControlCreator(ISourceViewer sourceViewer)
Returns the information control creator.
|
IInformationPresenter |
getInformationPresenter(ISourceViewer sourceViewer)
Returns the information presenter which will determine and shown
information requested for the current cursor position.
|
IAnnotationHover |
getOverviewRulerAnnotationHover(ISourceViewer sourceViewer)
Returns the annotation hover which will provide the information to be
shown in a hover popup window when requested for the overview ruler
of the given source viewer.This implementation always returns the general
annotation hover returned by
getAnnotationHover . |
IPresentationReconciler |
getPresentationReconciler(ISourceViewer sourceViewer)
Returns the presentation reconciler ready to be used with the given source viewer.
|
IQuickAssistAssistant |
getQuickAssistAssistant(ISourceViewer sourceViewer)
Returns the quick assist assistant ready to be used with the given
source viewer.
|
IReconciler |
getReconciler(ISourceViewer sourceViewer)
Returns the reconciler ready to be used with the given source viewer.
|
int |
getTabWidth(ISourceViewer sourceViewer)
Returns the visual width of the tab character.
|
ITextHover |
getTextHover(ISourceViewer sourceViewer,
String contentType)
Returns the text hover which will provide the information to be shown
in a text hover popup window when requested for the given source viewer and
the given content type.
|
ITextHover |
getTextHover(ISourceViewer sourceViewer,
String contentType,
int stateMask)
Returns the text hover which will provide the information to be shown
in a text hover popup window when requested for the given source viewer and
the given content type.
|
IUndoManager |
getUndoManager(ISourceViewer sourceViewer)
Returns the undo manager for the given source viewer.
|
public SourceViewerConfiguration()
public int getTabWidth(ISourceViewer sourceViewer)
sourceViewer
- the source viewer to be configured by this configurationpublic IUndoManager getUndoManager(ISourceViewer sourceViewer)
DefaultUndoManager
whose
history length is set to 25.sourceViewer
- the source viewer to be configured by this configurationnull
if no undo/redo should not be supportedpublic IReconciler getReconciler(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if reconciling should not be supportedpublic IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
sourceViewer
- the source viewernull
if presentation reconciling should not be supportedpublic IContentFormatter getContentFormatter(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if formatting should not be supportedpublic IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if content assist should not be supportedpublic IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if quick assist should not be supportedpublic IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType)
getAutoEditStrategies(ISourceViewer, String)
insteadDefaultAutoIndentStrategy
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content type for which the strategy is applicablenull
if automatic indentation is not to be enabledpublic IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType)
getAutoIndentStrategy(ISourceViewer, String)
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content type for which the strategies are applicablenull
if automatic editing is not to be enabledpublic String[] getDefaultPrefixes(ISourceViewer sourceViewer, String contentType)
null
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content type for which the prefix is applicablenull
if the prefix operation should not be supportedpublic ITextDoubleClickStrategy getDoubleClickStrategy(ISourceViewer sourceViewer, String contentType)
DefaultTextDoubleClickStrategy
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content type for which the strategy is applicablenull
if double clicking should not be supportedpublic String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
new String[] { "\t", " ", "" }
.
Note: This default is incorrect but cannot be changed in order not
to break any existing clients. Subclasses should overwrite this method and
use getIndentPrefixesForTab(int)
if applicable.
sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content type for which the prefix is applicablenull
if the prefix operation should not be supportedprotected String[] getIndentPrefixesForTab(int tabWidth)
tabSizeInSpaces
.tabWidth
- the display tab widthgetIndentPrefixes(ISourceViewer, String)
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if no hover support should be installedpublic IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer)
getAnnotationHover
.sourceViewer
- the source viewer to be configured by this configurationnull
if no hover support should be installedpublic int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType)
sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content typeint
array with the configured SWT event state masks
or null
if text hovers are not supported for the given content typepublic ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask)
null
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content typestateMask
- the SWT event state masknull
if no hover support should be installedpublic ITextHover getTextHover(ISourceViewer sourceViewer, String contentType)
null
.sourceViewer
- the source viewer to be configured by this configurationcontentType
- the content typenull
if no hover support should be installedpublic IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer)
DefaultInformationControl
instances.sourceViewer
- the source viewer to be configured by this configurationnull
if no information support should be installedpublic IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer)
null
.sourceViewer
- the source viewer to be configured by this configurationnull
if no information presenter should be installedpublic String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
new String[] { IDocument.DEFAULT_CONTENT_TYPE }
.sourceViewer
- the source viewer to be configured by this configurationpublic String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
IDocumentExtension3.DEFAULT_PARTITIONING
.sourceViewer
- the source viewer to be configured by this configurationgetConfiguredContentTypes(ISourceViewer)
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer)
sourceViewer
- the source viewer to be configured by this configurationnull
if no hyperlink support should be installedpublic IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
DefaultHyperlinkPresenter
.sourceViewer
- the source viewer to be configured by this configurationnull
if no hyperlink support should be installedpublic int getHyperlinkStateMask(ISourceViewer sourceViewer)
SWT.MOD1
.sourceViewer
- the source viewer to be configured by this configuration
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.