refactory: added UI removed from core plugin.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / text / spelling / engine / ISpellChecker.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.Set;
15
16 /**
17  * Interface for spell-checkers.
18  * 
19  * @since 3.0
20  */
21 public interface ISpellChecker {
22
23         /**
24          * Adds a dictionary to the list of active dictionaries.
25          * 
26          * @param dictionary
27          *            The dictionary to add
28          */
29         public void addDictionary(ISpellDictionary dictionary);
30
31         /**
32          * Adds a spell event listener to the active listeners.
33          * 
34          * @param listener
35          *            The listener to add
36          */
37         public void addListener(ISpellEventListener listener);
38
39         /**
40          * Returns whether this spell checker accepts word additions.
41          * 
42          * @return <code>true</code> if word additions are accepted,
43          *         <code>false</code> otherwise
44          */
45         public boolean acceptsWords();
46
47         /**
48          * Adds the specified word to the set of correct words.
49          * 
50          * @param word
51          *            The word to add to the set of correct words
52          */
53         public void addWord(String word);
54
55         /**
56          * Checks the specified word until calling <code>ignoreWord(String)</code>.
57          * 
58          * @param word
59          *            The word to check
60          */
61         public void checkWord(String word);
62
63         /**
64          * Checks the spelling with the spell-check iterator. Implementations must
65          * be thread safe as this may be called inside a reconciler thread.
66          * 
67          * @param iterator
68          *            The iterator to use for spell-checking
69          */
70         public void execute(ISpellCheckIterator iterator);
71
72         /**
73          * Returns the ranked proposals for a word.
74          * 
75          * @param word
76          *            The word to retrieve the proposals for
77          * @param sentence
78          *            <code>true</code> iff the proposals should start a sentence,
79          *            <code>false</code> otherwise
80          * @return Set of ranked proposals for the word
81          */
82         public Set getProposals(String word, boolean sentence);
83
84         /**
85          * Ignores the specified word until calling <code>checkWord(String)</code>.
86          * 
87          * @param word
88          *            The word to ignore
89          */
90         public void ignoreWord(String word);
91
92         /**
93          * Is the specified word correctly spelled? Implementations must be thread
94          * safe as this may be called from within a reconciler thread.
95          * 
96          * @param word
97          *            The word to check its spelling
98          * @return <code>true</code> iff the word is correctly spelled,
99          *         <code>false</code> otherwise
100          */
101         public boolean isCorrect(String word);
102
103         /**
104          * Remove a dictionary from the list of active dictionaries.
105          * 
106          * @param dictionary
107          *            The dictionary to remove
108          */
109         public void removeDictionary(ISpellDictionary dictionary);
110
111         /**
112          * Removes a spell event listener from the active listeners.
113          * 
114          * @param listener
115          *            The listener to remove
116          */
117         public void removeListener(ISpellEventListener listener);
118 }