refactory: added UI removed from core plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / 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
49          * <code>registerDictionary(Locale,ISpellDictionary)</code> for each of
50          * the locales returned by <code>Locale.getAvailableLocales()</code>.
51          * </p>
52          * 
53          * @param dictionary
54          *            The dictionary to register
55          */
56         void registerDictionary(ISpellDictionary dictionary);
57
58         /**
59          * Registers a dictionary tuned for the specified locale with this engine.
60          * 
61          * @param locale
62          *            The locale to register the dictionary with
63          * @param dictionary
64          *            The dictionary to register
65          */
66         void registerDictionary(Locale locale, ISpellDictionary dictionary);
67
68         /**
69          * Unloads the spell check engine and its associated components.
70          * <p>
71          * All registered dictionaries are unloaded and the engine unregisters for
72          * preference changes. After a new call to
73          * <code>getSpellChecker(Locale)</code>, it registers again for
74          * preference changes. The dictionaries perform lazy loading, that is to say
75          * on the next query they reload their associated word lists.
76          */
77         void unload();
78
79         /**
80          * Unregisters a dictionary previously registered either by a call to
81          * <code>registerDictionary(Locale,ISpellDictionary)</code> or
82          * <code>registerDictionary(ISpellDictionary)</code>. If the dictionary
83          * was not registered before, nothing happens.
84          * 
85          * @param dictionary
86          *            The dictionary to unregister
87          */
88         void unregisterDictionary(ISpellDictionary dictionary);
89 }