Class SpellingService


  • public class SpellingService
    extends Object
    System wide spelling service.

    This class is not intended to be subclassed by clients.

    Since:
    3.1
    Restriction:
    This class is not intended to be subclassed by clients.
    • Field Detail

      • PREFERENCE_SPELLING_ENABLED

        public static final String PREFERENCE_SPELLING_ENABLED
        A named preference that controls if spelling is enabled or disabled.

        Value is of type Boolean.

        See Also:
        Constant Field Values
      • PREFERENCE_SPELLING_ENGINE

        public static final String PREFERENCE_SPELLING_ENGINE
        A named preference that controls which spelling engine is used. The value is the spelling engine's extension id.

        Value is of type String.

        See Also:
        Constant Field Values
    • Method Detail

      • check

        public void check​(IDocument document,
                          SpellingContext context,
                          ISpellingProblemCollector collector,
                          IProgressMonitor monitor)
        Checks the given document. Reports all found spelling problems to the collector. The spelling engine is chosen based on the settings from the given preferences.
        Parameters:
        document - the document to check
        context - the context
        collector - the problem collector
        monitor - the progress monitor, can be null
      • check

        public void check​(IDocument document,
                          IRegion[] regions,
                          SpellingContext context,
                          ISpellingProblemCollector collector,
                          IProgressMonitor monitor)
        Checks the given regions in the given document. Reports all found spelling problems to the collector. The spelling engine is chosen based on the settings from the given preferences.
        Parameters:
        document - the document to check
        regions - the regions to check
        context - the context
        collector - the problem collector
        monitor - the progress monitor, can be null
      • getSpellingEngineDescriptors

        public SpellingEngineDescriptor[] getSpellingEngineDescriptors()
        Returns all spelling engine descriptors from extensions to the spelling engine extension point.
        Returns:
        all spelling engine descriptors
      • getDefaultSpellingEngineDescriptor

        public SpellingEngineDescriptor getDefaultSpellingEngineDescriptor()
        Returns the default spelling engine descriptor from extensions to the spelling engine extension point.
        Returns:
        the default spelling engine descriptor or null if none could be found
      • getActiveSpellingEngineDescriptor

        public SpellingEngineDescriptor getActiveSpellingEngineDescriptor​(IPreferenceStore preferences)
        Returns the descriptor of the active spelling engine based on the value of the PREFERENCE_SPELLING_ENGINE preference in the given preferences.
        Parameters:
        preferences - the preferences
        Returns:
        the descriptor of the active spelling engine or null if none could be found
        See Also:
        PREFERENCE_SPELLING_ENGINE