RC2 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / ui / text / spelling / engine / ISpellCheckEngine.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11
12 package net.sourceforge.phpdt.internal.ui.text.spelling.engine;
13
14 import java.util.Locale;
15
16 import org.eclipse.jface.preference.IPreferenceStore;
17
18 /**
19  * Interface for spell-check engines.
20  * 
21  * @since 3.0
22  */
23 public interface ISpellCheckEngine {
24
25         /**
26          * Creates a configured instance of a spell-checker that uses the
27          * appropriate dictionaries.
28          * 
29          * @param locale
30          *                   The locale to get the spell checker for
31          * @param store
32          *                   The preference store for the spell-checker
33          * @return A configured instance of a spell checker, or <code>null</code>
34          *               iff no dictionary could be found for that locale
35          */
36         ISpellChecker createSpellChecker(Locale locale, IPreferenceStore store);
37
38         /**
39          * Returns the current locale of the spell check engine.
40          * 
41          * @return The current locale of the engine
42          */
43         Locale getLocale();
44
45         /**
46          * Registers a dictionary for all locales available on the platform.
47          * <p>
48          * This call is equivalent to calling <code>registerDictionary(Locale,ISpellDictionary)</code>
49          * for each of the locales returned by <code>Locale.getAvailableLocales()</code>.
50          * </p>
51          * 
52          * @param dictionary
53          *                   The dictionary to register
54          */
55         void registerDictionary(ISpellDictionary dictionary);
56
57         /**
58          * Registers a dictionary tuned for the specified locale with this engine.
59          * 
60          * @param locale
61          *                   The locale to register the dictionary with
62          * @param dictionary
63          *                   The dictionary to register
64          */
65         void registerDictionary(Locale locale, ISpellDictionary dictionary);
66
67         /**
68          * Unloads the spell check engine and its associated components.
69          * <p>
70          * All registered dictionaries are unloaded and the engine unregisters for
71          * preference changes. After a new call to <code>getSpellChecker(Locale)</code>,
72          * it registers again for preference changes. The dictionaries perform lazy
73          * loading, that is to say on the next query they reload their associated
74          * word lists.
75          */
76         void unload();
77
78         /**
79          * Unregisters a dictionary previously registered either by a call to
80          * <code>registerDictionary(Locale,ISpellDictionary)</code> or <code>registerDictionary(ISpellDictionary)</code>.
81          * If the dictionary was not registered before, nothing happens.
82          * 
83          * @param dictionary
84          *                   The dictionary to unregister
85          */
86         void unregisterDictionary(ISpellDictionary dictionary);
87 }