Commit [3d492b] Maximize Restore History

-> ignore-all on a per-buffer basis,

-> user dictionary (not editable yet)
both features still need testing

git-svn-id: https://jedit.svn.sourceforge.net/svnroot/jedit/plugins/SpellCheck/trunk@13047 6b1eeb88-9816-0410-afa2-b43733a0f04e

kerik-sf kerik-sf 2008-07-12

1 2 > >> (Page 1 of 2)
added src/main/cswilly/jeditPlugins/spell/AspellEngineManager.java
added src/main/cswilly/spell/EngineManager.java
added src/main/cswilly/spell/WordListValidator.java
added src/test/cswilly/jeditPlugins/spell/AspellEngineManagerTest.java
changed src/main/cswilly/jeditPlugins/spell/BufferDialogValidator.java
changed src/main/cswilly/jeditPlugins/spell/BufferSpellChecker.java
changed src/main/cswilly/jeditPlugins/spell/DictionaryPicker.java
changed src/main/cswilly/jeditPlugins/spell/ErrorListSpellChecker.java
changed src/main/cswilly/jeditPlugins/spell/ErrorListValidator.java
changed src/main/cswilly/jeditPlugins/spell/SpellCheckOptionPane.java
changed src/main/cswilly/jeditPlugins/spell/SpellCheckPlugin.java
changed src/main/cswilly/spell/AspellEngine.java
changed src/main/cswilly/spell/DialogValidator.java
changed src/main/cswilly/spell/FileSpellChecker.java
changed src/main/cswilly/spell/Result.java
changed src/main/cswilly/spell/ValidationDialog.java
changed src/main/cswilly/spell/Validator.java
changed src/test/cswilly/jeditPlugins/spell/BufferDialogValidatorTest.java
changed src/test/cswilly/jeditPlugins/spell/BufferSpellCheckerTest.java
changed src/test/cswilly/jeditPlugins/spell/DictionaryPickerTest.java
changed src/test/cswilly/jeditPlugins/spell/SpellCheckOptionPaneTest.java
changed src/test/cswilly/jeditPlugins/spell/SpellCheckPluginTest.java
changed src/test/cswilly/jeditPlugins/spell/TestUtils.java
copied src/main/cswilly/spell/Test.java -> src/main/cswilly/spell/ChainingValidator.java
src/main/cswilly/jeditPlugins/spell/AspellEngineManager.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/EngineManager.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/WordListValidator.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/AspellEngineManagerTest.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/BufferDialogValidator.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/BufferSpellChecker.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/DictionaryPicker.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/ErrorListSpellChecker.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/ErrorListValidator.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/SpellCheckOptionPane.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/jeditPlugins/spell/SpellCheckPlugin.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/AspellEngine.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/DialogValidator.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/FileSpellChecker.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/Result.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/ValidationDialog.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/Validator.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/BufferDialogValidatorTest.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/BufferSpellCheckerTest.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/DictionaryPickerTest.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/SpellCheckOptionPaneTest.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/SpellCheckPluginTest.java Diff Switch to side-by-side view
Loading...
src/test/cswilly/jeditPlugins/spell/TestUtils.java Diff Switch to side-by-side view
Loading...
src/main/cswilly/spell/Test.java to src/main/cswilly/spell/ChainingValidator.java
--- a/src/main/cswilly/spell/Test.java
+++ b/src/main/cswilly/spell/ChainingValidator.java
@@ -20,69 +20,63 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-
 package cswilly.spell;
 
-import java.io.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
 
-public
-class Test
+/**
+ * A validator implementation which encapsulate a list of validators
+ *
+ */ 
+public class ChainingValidator implements Validator
 {
-  BufferedReader _aSpellReader;
-  BufferedWriter _aSpellWriter;
+	private Validator mine;
+	private Validator next;
+	
+	public ChainingValidator(Validator mine, Validator next){
+		this.mine = mine;
+		this.next = next;
+	}
+  	
+	public Validator getMyValidator(){
+		return mine;
+	}
+	
+	public Validator getNextValidator(){
+		return next;
+	}
+	
+  /**
+   * Validate a line of words that have the <code>results</code> of a spell
+   * check.
+   *<p>
+   * @param	lineNum	index of the line in the text/buffer/file whatever
+   * @param line String with a line of words that are to be corrected
+   * @param results List of {@link Result} of a spell check
+   * @return valid (false to cancel)
+   */
+  public boolean validate( int lineNum, String line, List<Result> results ){
+	  boolean valid = true;
+	  valid=mine.validate(lineNum, line, results);
+	  if(valid)valid = next.validate(lineNum, line, results);
+	  return valid;
+  }
+  
+  /**
+   * Call this upon new spell-checking
+   */
+   public void start(){
+	   mine.start();
+	   next.start();
+   }
 
-  public static
-  void main( String[] args )
-    throws IOException
-  {
-    new Test();
-  }
-
-  private Test()
-    throws IOException
-  {
-    System.err.println( "TestTest" );
-
-    String aSpellCommandLine = "O:\\local\\aspell\\aspell.exe pipe";
-
-    Runtime runtime = Runtime.getRuntime();
-    Process aSpellProcess = runtime.exec( aSpellCommandLine );
-
-    _aSpellReader =
-      new BufferedReader( new InputStreamReader( aSpellProcess.getInputStream() ) );
-
-    _aSpellWriter =
-      new BufferedWriter( new OutputStreamWriter( aSpellProcess.getOutputStream() ) );
-
-    String aSpellWelcomeMsg;
-    aSpellWelcomeMsg = _aSpellReader.readLine();
-    System.err.println( "aSpellWelcomeMsg: " + aSpellWelcomeMsg );
-
-    checkWords( "expetr nobody noboyd response" );
-    checkWords( "table lable llll" );
-  }
-
-  private
-  void checkWords( String words )
-    throws IOException
-  {
-    System.err.println( "words: " + words );
-
-    final String spellCheckLinePrefix = "^";
-    _aSpellWriter.write( spellCheckLinePrefix + words );
-    _aSpellWriter.newLine();
-    _aSpellWriter.flush();
-
-    String response = _aSpellReader.readLine();
-    while( response != null &&
-           !response.equals( "" ) )
-    {
-      System.err.println( "response: " + response );
-      Result result = new Result( response );
-      System.err.println( "result: " + result );
-
-      response = _aSpellReader.readLine();
-    }
-  }
-
+  /**
+   * Call this at the end of spell-checking
+   */
+   public void done(){
+	   mine.done();
+	   next.done();
+   }
 }
1 2 > >> (Page 1 of 2)