Class TextSourceViewerConfiguration

java.lang.Object
org.eclipse.jface.text.source.SourceViewerConfiguration
org.eclipse.ui.editors.text.TextSourceViewerConfiguration

public class TextSourceViewerConfiguration extends SourceViewerConfiguration
Source viewer configuration for the text editor.
Since:
3.0
  • Field Details

    • fPreferenceStore

      protected IPreferenceStore fPreferenceStore
      The preference store used to initialize this configuration.

      Note: protected since 3.1

  • Constructor Details

    • TextSourceViewerConfiguration

      public TextSourceViewerConfiguration()
      Creates a text source viewer configuration.
    • TextSourceViewerConfiguration

      public TextSourceViewerConfiguration(IPreferenceStore preferenceStore)
      Creates a text source viewer configuration and initializes it with the given preference store.
      Parameters:
      preferenceStore - the preference store used to initialize this configuration
  • Method Details

    • getAnnotationHover

      public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      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 returns null.
      Overrides:
      getAnnotationHover in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      an annotation hover or null if no hover support should be installed
    • isShowInVerticalRuler

      protected boolean isShowInVerticalRuler(Annotation annotation)
    • getOverviewRulerAnnotationHover

      public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      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.
      Overrides:
      getOverviewRulerAnnotationHover in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      an annotation hover or null if no hover support should be installed
    • isShowInOverviewRuler

      protected boolean isShowInOverviewRuler(Annotation annotation)
    • getConfiguredTextHoverStateMasks

      public int[] getConfiguredTextHoverStateMasks(ISourceViewer sourceViewer, String contentType)
      Description copied from class: SourceViewerConfiguration
      Returns the SWT event state masks for which text hover are configured for the given content type.
      Overrides:
      getConfiguredTextHoverStateMasks in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      contentType - the content type
      Returns:
      an int array with the configured SWT event state masks or null if text hovers are not supported for the given content type
    • getTextHover

      public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType)
      Description copied from class: SourceViewerConfiguration
      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 returns null.
      Overrides:
      getTextHover in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      contentType - the content type
      Returns:
      a text hover or null if no hover support should be installed
    • isShownInText

      protected boolean isShownInText(Annotation annotation)
    • getTabWidth

      public int getTabWidth(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      Returns the visual width of the tab character. This implementation always returns 4.
      Overrides:
      getTabWidth in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      the tab width
    • getIndentPrefixes

      public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType)
      Description copied from class: SourceViewerConfiguration
      Returns the prefixes to be used by the line-shift operation. This implementation always returns 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 SourceViewerConfiguration.getIndentPrefixesForTab(int) if applicable.

      Overrides:
      getIndentPrefixes in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      contentType - the content type for which the prefix is applicable
      Returns:
      the prefixes or null if the prefix operation should not be supported
    • getHyperlinkDetectors

      public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      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.
      Overrides:
      getHyperlinkDetectors in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      an array with hyperlink detectors or null if no hyperlink support should be installed
    • getRegisteredHyperlinkDetectors

      protected final IHyperlinkDetector[] getRegisteredHyperlinkDetectors(ISourceViewer sourceViewer)
      Returns the registered hyperlink detectors which are used to detect hyperlinks in the given source viewer.
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      an array with hyperlink detectors or null if no hyperlink detectors are registered
      Since:
      3.3
    • getHyperlinkDetectorTargets

      protected Map<String,IAdaptable> getHyperlinkDetectorTargets(ISourceViewer sourceViewer)
      Returns the hyperlink detector targets supported by the given source viewer.

      Subclasses are allowed to modify the returned map.

      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      the hyperlink detector targets with target id (String) as key and the target context (IAdaptable) as value
      Since:
      3.3
    • getHyperlinkStateMask

      public int getHyperlinkStateMask(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      Returns the SWT event state mask which in combination with the left mouse button activates hyperlinking. This implementation always returns the SWT.MOD1.
      Overrides:
      getHyperlinkStateMask in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      the SWT event state mask to activate hyperlink mode
    • getHyperlinkPresenter

      public IHyperlinkPresenter getHyperlinkPresenter(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      Returns the hyperlink presenter for the given source viewer. This implementation always returns the DefaultHyperlinkPresenter.
      Overrides:
      getHyperlinkPresenter in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      the hyperlink presenter or null if no hyperlink support should be installed
    • findLocalizedModifier

      protected static final int findLocalizedModifier(String modifierName)
      Maps the localized modifier name to a code in the same manner as #findModifier.
      Parameters:
      modifierName - the modifier name
      Returns:
      the SWT modifier bit, or 0 if no match was found
      Since:
      3.1
    • computeStateMask

      protected static final int computeStateMask(String modifiers)
      Computes the state mask out of the given modifiers string.
      Parameters:
      modifiers - a string containing modifiers
      Returns:
      the state mask
      Since:
      3.1
    • getUndoManager

      public IUndoManager getUndoManager(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      Returns the undo manager for the given source viewer. This implementation always returns a new instance of DefaultUndoManager whose history length is set to 25.
      Overrides:
      getUndoManager in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      an undo manager or null if 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 currently returns a MonoReconciler which is responsible for spell checking. In the future a different reconciler taking over more responsibilities might be returned.

      Overrides:
      getReconciler in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      a reconciler or null if reconciling should not be supported
      Since:
      3.3
      See Also:
    • getQuickAssistAssistant

      public IQuickAssistAssistant getQuickAssistAssistant(ISourceViewer sourceViewer)
      Description copied from class: SourceViewerConfiguration
      Returns the quick assist assistant ready to be used with the given source viewer. This implementation always returns null.
      Overrides:
      getQuickAssistAssistant in class SourceViewerConfiguration
      Parameters:
      sourceViewer - the source viewer to be configured by this configuration
      Returns:
      a quick assist assistant or null if quick assist should not be supported