RC2 compatibility
[phpeclipse.git] / net.sourceforge.phpeclipse / 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, <code>false</code> otherwise
43          */
44         public boolean acceptsWords();
45
46         /**
47          * Adds the specified word to the set of correct words.
48          * 
49          * @param word
50          *                   The word to add to the set of correct words
51          */
52         public void addWord(String word);
53
54         /**
55          * Checks the specified word until calling <code>ignoreWord(String)</code>.
56          * 
57          * @param word
58          *                   The word to check
59          */
60         public void checkWord(String word);
61
62         /**
63          * Checks the spelling with the spell-check iterator. Implementations must
64          * be thread safe as this may be called inside a reconciler thread.
65          * 
66          * @param iterator
67          *                   The iterator to use for spell-checking
68          */
69         public void execute(ISpellCheckIterator iterator);
70
71         /**
72          * Returns the ranked proposals for a word.
73          * 
74          * @param word
75          *                   The word to retrieve the proposals for
76          * @param sentence
77          *                   <code>true</code> iff the proposals should start a
78          *                   sentence, <code>false</code> otherwise
79          * @return Set of ranked proposals for the word
80          */
81         public Set getProposals(String word, boolean sentence);
82
83         /**
84          * Ignores the specified word until calling <code>checkWord(String)</code>.
85          * 
86          * @param word
87          *                   The word to ignore
88          */
89         public void ignoreWord(String word);
90
91         /**
92          * Is the specified word correctly spelled? Implementations must be thread
93          * safe as this may be called from within a reconciler thread.
94          * 
95          * @param word
96          *                   The word to check its spelling
97          * @return <code>true</code> iff the word is correctly spelled, <code>false</code>
98          *               otherwise
99          */
100         public boolean isCorrect(String word);
101
102         /**
103          * Remove a dictionary from the list of active dictionaries.
104          * 
105          * @param dictionary
106          *                   The dictionary to remove
107          */
108         public void removeDictionary(ISpellDictionary dictionary);
109
110         /**
111          * Removes a spell event listener from the active listeners.
112          * 
113          * @param listener
114          *                   The listener to remove
115          */
116         public void removeListener(ISpellEventListener listener);
117 }