* @see #getMarkAllHighlightColor
* @see #setMarkAllHighlightColor
*/
public int markAll(String toMark, boolean matchCase, boolean wholeWord,
boolean regex) {
Highlighter h = getHighlighter();
int numMarked = 0;
if (toMark!=null && !toMark.equals(markedWord) && h!=null) {
if (markAllHighlights!=null)
clearMarkAllHighlights();
else
markAllHighlights = new ArrayList(10);
int caretPos = getCaretPosition();
markedWord = toMark;
setCaretPosition(0);
boolean found = SearchEngine.find(this, toMark, true, matchCase,
wholeWord, regex);
while (found) {
int start = getSelectionStart();
int end = getSelectionEnd();
try {
markAllHighlights.add(h.addHighlight(start, end,
markAllHighlightPainter));
} catch (BadLocationException ble) {
ble.printStackTrace();
}
numMarked++;