Package org.eclipse.jface.text.source
Class SourceViewerConfiguration
- java.lang.Object
-
- org.eclipse.jface.text.source.SourceViewerConfiguration
-
- Direct Known Subclasses:
TextSourceViewerConfiguration
public class SourceViewerConfiguration extends Object
This class bundles the configuration space of a source viewer. Instances of this class are passed to theconfiguremethod ofISourceViewer.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.
- See Also:
ISourceViewer
-
-
Constructor Summary
Constructors Constructor Description SourceViewerConfiguration()Creates a new source viewer configuration that behaves according to specification of this class' methods.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IAnnotationHovergetAnnotationHover(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.IAutoIndentStrategygetAutoIndentStrategy(ISourceViewer sourceViewer, String contentType)Deprecated.since 3.1 usegetAutoEditStrategies(ISourceViewer, String)insteadorg.eclipse.jface.text.codemining.ICodeMiningProvider[]getCodeMiningProviders(ISourceViewer sourceViewer)Returns the code mining providers which be used to draw code minings in the given source viewer.String[]getConfiguredContentTypes(ISourceViewer sourceViewer)Returns all configured content types for the given source viewer.StringgetConfiguredDocumentPartitioning(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.IContentAssistantgetContentAssistant(ISourceViewer sourceViewer)Returns the content assistant ready to be used with the given source viewer.IContentFormattergetContentFormatter(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.ITextDoubleClickStrategygetDoubleClickStrategy(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.IHyperlinkPresentergetHyperlinkPresenter(ISourceViewer sourceViewer)Returns the hyperlink presenter for the given source viewer.intgetHyperlinkStateMask(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 astabSizeInSpaces.IInformationControlCreatorgetInformationControlCreator(ISourceViewer sourceViewer)Returns the information control creator.IInformationPresentergetInformationPresenter(ISourceViewer sourceViewer)Returns the information presenter which will determine and shown information requested for the current cursor position.IAnnotationHovergetOverviewRulerAnnotationHover(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 bygetAnnotationHover.IPresentationReconcilergetPresentationReconciler(ISourceViewer sourceViewer)Returns the presentation reconciler ready to be used with the given source viewer.IQuickAssistAssistantgetQuickAssistAssistant(ISourceViewer sourceViewer)Returns the quick assist assistant ready to be used with the given source viewer.IReconcilergetReconciler(ISourceViewer sourceViewer)Returns the reconciler ready to be used with the given source viewer.intgetTabWidth(ISourceViewer sourceViewer)Returns the visual width of the tab character.ITextHovergetTextHover(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.ITextHovergetTextHover(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.IUndoManagergetUndoManager(ISourceViewer sourceViewer)Returns the undo manager for the given source viewer.
-
-
-
Method Detail
-
getTabWidth
public int getTabWidth(ISourceViewer sourceViewer)
Returns the visual width of the tab character. This implementation always returns 4.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the tab width
-
getUndoManager
public IUndoManager getUndoManager(ISourceViewer sourceViewer)
Returns the undo manager for the given source viewer. This implementation always returns a new instance ofDefaultUndoManagerwhose history length is set to 25.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an undo manager or
nullif no undo/redo should not be supported
-
getReconciler
public IReconciler getReconciler(ISourceViewer sourceViewer)
Returns the reconciler ready to be used with the given source viewer. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- a reconciler or
nullif reconciling should not be supported
-
getPresentationReconciler
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
Returns the presentation reconciler ready to be used with the given source viewer.- Parameters:
sourceViewer- the source viewer- Returns:
- the presentation reconciler or
nullif presentation reconciling should not be supported
-
getContentFormatter
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer)
Returns the content formatter ready to be used with the given source viewer. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- a content formatter or
nullif formatting should not be supported
-
getContentAssistant
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer)
Returns the content assistant ready to be used with the given source viewer. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- a content assistant or
nullif content assist should not be supported
-
getQuickAssistAssistant
public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer)
Returns the quick assist assistant ready to be used with the given source viewer. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- a quick assist assistant or
nullif quick assist should not be supported - Since:
- 3.2
-
getAutoIndentStrategy
@Deprecated public IAutoIndentStrategy getAutoIndentStrategy(ISourceViewer sourceViewer, String contentType)
Deprecated.since 3.1 usegetAutoEditStrategies(ISourceViewer, String)insteadReturns the auto indentation strategy ready to be used with the given source viewer when manipulating text of the given content type. This implementation always returns an new instance ofDefaultAutoIndentStrategy.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type for which the strategy is applicable- Returns:
- the auto indent strategy or
nullif automatic indentation is not to be enabled
-
getAutoEditStrategies
public 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. For backward compatibility, this implementation always returns an array containing the result ofgetAutoIndentStrategy(ISourceViewer, String).- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type for which the strategies are applicable- Returns:
- the auto edit strategies or
nullif automatic editing is not to be enabled - Since:
- 3.1
-
getDefaultPrefixes
public 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. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type for which the prefix is applicable- Returns:
- the default prefixes or
nullif the prefix operation should not be supported - Since:
- 2.0
-
getDoubleClickStrategy
public 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. This implementation always returns a new instance ofDefaultTextDoubleClickStrategy.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type for which the strategy is applicable- Returns:
- a double-click strategy or
nullif double clicking should not be supported
-
getIndentPrefixes
public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
Returns the prefixes to be used by the line-shift operation. This implementation always returnsnew 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.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type for which the prefix is applicable- Returns:
- the prefixes or
nullif the prefix operation should not be supported
-
getIndentPrefixesForTab
protected String[] getIndentPrefixesForTab(int tabWidth)
Computes and returns the indent prefixes for tab indentation which is represented astabSizeInSpaces.- Parameters:
tabWidth- the display tab width- Returns:
- the indent prefixes
- Since:
- 3.3
- See Also:
getIndentPrefixes(ISourceViewer, String)
-
getAnnotationHover
public 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. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an annotation hover or
nullif no hover support should be installed
-
getOverviewRulerAnnotationHover
public 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 bygetAnnotationHover.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an annotation hover or
nullif no hover support should be installed - Since:
- 3.0
-
getConfiguredTextHoverStateMasks
public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType)
Returns the SWT event state masks for which text hover are configured for the given content type.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type- Returns:
- an
intarray with the configured SWT event state masks ornullif text hovers are not supported for the given content type - Since:
- 2.1
-
getTextHover
public 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. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content typestateMask- the SWT event state mask- Returns:
- a text hover or
nullif no hover support should be installed - Since:
- 2.1
-
getTextHover
public 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. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configurationcontentType- the content type- Returns:
- a text hover or
nullif no hover support should be installed
-
getInformationControlCreator
public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer)
Returns the information control creator. The creator is a factory creating information controls for the given source viewer. This implementation always returns a creator forDefaultInformationControlinstances.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the information control creator or
nullif no information support should be installed - Since:
- 2.0
-
getInformationPresenter
public IInformationPresenter getInformationPresenter(ISourceViewer sourceViewer)
Returns the information presenter which will determine and shown information requested for the current cursor position. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an information presenter
nullif no information presenter should be installed - Since:
- 2.0
-
getConfiguredContentTypes
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer)
Returns all configured content types for the given source viewer. This list tells the caller which content types must be configured for the given source viewer, i.e. for which content types the given source viewer's functionalities must be specified. This implementation always returnsnew String[] { IDocument.DEFAULT_CONTENT_TYPE }.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the configured content types for the given viewer
-
getConfiguredDocumentPartitioning
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer)
Returns the configured partitioning for the given source viewer. The partitioning is used when the querying content types from the source viewer's input document. This implementation always returnsIDocumentExtension3.DEFAULT_PARTITIONING.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the configured partitioning
- Since:
- 3.0
- See Also:
getConfiguredContentTypes(ISourceViewer)
-
getHyperlinkDetectors
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer)
Returns the hyperlink detectors which be used to detect hyperlinks in the given source viewer. This implementation always returns an array with an URL hyperlink detector.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an array with hyperlink detectors or
nullif no hyperlink support should be installed - Since:
- 3.1
-
getHyperlinkPresenter
public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
Returns the hyperlink presenter for the given source viewer. This implementation always returns theDefaultHyperlinkPresenter.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the hyperlink presenter or
nullif no hyperlink support should be installed - Since:
- 3.1
-
getHyperlinkStateMask
public int getHyperlinkStateMask(ISourceViewer sourceViewer)
Returns the SWT event state mask which in combination with the left mouse button activates hyperlinking. This implementation always returns theSWT.MOD1.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- the SWT event state mask to activate hyperlink mode
- Since:
- 3.1
-
getCodeMiningProviders
public org.eclipse.jface.text.codemining.ICodeMiningProvider[] getCodeMiningProviders(ISourceViewer sourceViewer)
Returns the code mining providers which be used to draw code minings in the given source viewer. This implementation always returnsnull.- Parameters:
sourceViewer- the source viewer to be configured by this configuration- Returns:
- an array with code mining providers or
nullif no code mining support should be installed - Since:
- 3.13
-
-