void (boolean processFromTheBeginning, TextRange cursor, boolean toNotify, boolean justReplaced, boolean retainOldSelection) { if (myNotFoundState) { myNotFoundState = false; processFromTheBeginning = true; } FindResult next; if ((!myFindModel.isGlobal() || justReplaced) && cursor != null) { next = nextOccurrence(cursor); } else { next = firstOccurrenceAfterCaret(); } if (next == null) { if (processFromTheBeginning) { if (hasMatches()) { next = getOccurrences().get(0); } } else { setNotFoundState(true); } } if (toNotify) { if (next != null) { moveCursorTo(next, retainOldSelection, true); } } else { myCursor = next; } }