Revision: 6bd2021e4e30 Branch: new1738 Author: Rebecca Luttmer <rebecca.luttmer@xxxxxxxxx> Date: Fri Feb 6 20:13:36 2015 UTC Log: search replaces the first occurance rt1898 https://code.google.com/p/brailleblaster/source/detail?r=6bd2021e4e30 Modified: /src/main/org/brailleblaster/search/SearchDialog.java =======================================--- /src/main/org/brailleblaster/search/SearchDialog.java Fri Feb 6 16:00:10 2015 UTC +++ /src/main/org/brailleblaster/search/SearchDialog.java Fri Feb 6 20:13:36 2015 UTC
@@ -1557,6 +1557,7 @@ // Grab search string. String findMeStr = searchCombo.getText(); + // Get number of characters in text view. int numChars = tv.view.getText().length(); @@ -1606,6 +1607,7 @@ // found. tv.view.setSelection(startCharIndex, endCharIndex); tv.view.setTopIndex(tv.view.getLineAtOffset(startCharIndex)); + System.out.println(tv.view.getSelectionText()); // Found it; break. return true; @@ -1861,6 +1863,12 @@ // Grab search string. String findMeStr = searchCombo.getText(); + + //tests to see if the user has used the find button and has selected + //text that they want to replace + if ((tv.view.getSelectionText()).equals(findMeStr)) { + return true; + }//if text selected // Get number of characters in text view. int numChars = tv.view.getText().length(); @@ -1982,6 +1990,12 @@ // Grab search string. String findMeStr = searchCombo.getText(); + + //tests to see if the user has used the find button and has selected + //text that they want to replace + if ((tv.view.getSelectionText()).equals(findMeStr)) { + return true; + }//if text selected // Get number of characters in text view. int numChars = tv.view.getText().length(); @@ -2064,6 +2078,12 @@ // Grab search string. String findMeStr = searchCombo.getText(); + + //tests to see if the user has used the find button and has selected + //text that they want to replace + if ((tv.view.getSelectionText()).equals(findMeStr)) { + return true; + }//if text selected // Get number of characters in text view. int numChars = tv.view.getText().length(); @@ -2193,6 +2213,12 @@ // Get number of characters in text view. int numChars = tv.view.getText().length(); + + //tests to see if the user has used the find button and has selected + //text that they want to replace + if ((tv.view.getSelectionText()).equals(findMeStr)) { + return true; + }//if text selected // If the search string is larger than the total number of // characters in the view, don't bother.