Package org.eclipse.ui.texteditor.spelling

## Class SpellingService

- java.lang.Object
- - org.eclipse.ui.texteditor.spelling.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 Summary

Fields
`static String` `PREFERENCE_SPELLING_ENABLED` A named preference that controls if spelling is enabled or disabled.
`static String` `PREFERENCE_SPELLING_ENGINE` A named preference that controls which spelling engine is used.

### Constructor Summary

Constructors
`SpellingService​(IPreferenceStore preferences)` Initializes the spelling service with the given preferences.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `check​(IDocument document, IRegion[] regions, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor)` Checks the given regions in the given document.
`void` `check​(IDocument document, SpellingContext context, ISpellingProblemCollector collector, IProgressMonitor monitor)` Checks the given document.
`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.
`SpellingEngineDescriptor` `getDefaultSpellingEngineDescriptor()` Returns the default spelling engine descriptor from extensions to the spelling engine extension point.
`SpellingEngineDescriptor[]` `getSpellingEngineDescriptors()` Returns all spelling engine descriptors from extensions to the spelling engine extension point.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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

### Constructor Detail

#### SpellingService

    public SpellingService​(IPreferenceStore preferences)

Initializes the spelling service with the given preferences.

Parameters:
  `preferences` - the preferences
See Also:
  `PREFERENCE_SPELLING_ENABLED`, `PREFERENCE_SPELLING_ENGINE`

### 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`