void () { FrameSearcher searcher; String prevPageText; String curPageText; String nextPageText; String tailText; char prefixSymbol; char postfixSymbol; long pagesAmount; int tailLength; long curPageNumber; ArrayList<SearchResult> allMatchesAtFrame; searcher = createFrameSearcher(options, project); tailLength = getTailLength(options); try { /* preparing init data... */ pagesAmount = fileDataProviderForSearch.getPagesAmount(); curPageNumber = getPageNumberForBeginning(pagesAmount, options); /* checking if it is the end... */ if (isTheEndOfSearchingCycle(curPageNumber, pagesAmount, options)) { myCallback.tellSearchIsFinished(this, curPageNumber); return; } prevPageText = curPageNumber > 0 ? fileDataProviderForSearch.getPage_wait(curPageNumber - 1).getText() : ""; curPageText = fileDataProviderForSearch.getPage_wait(curPageNumber).getText(); nextPageText = curPageNumber < pagesAmount - 1 ? fileDataProviderForSearch.getPage_wait(curPageNumber + 1).getText() : ""; tailText = getTailFromPage(nextPageText, tailLength); prefixSymbol = getPrefixSymbol(prevPageText); postfixSymbol = getPostfixSymbol(nextPageText, tailLength); while (true) { /* searching result in current page */ searcher.setFrame(curPageNumber, prefixSymbol, curPageText, tailText, postfixSymbol); allMatchesAtFrame = searcher.findAllMatchesAtFrame(); myCallback.tellFrameSearchResultsFound(this, curPageNumber, allMatchesAtFrame); if (isShouldStop()) { if (myProgressIndicator != null) { myProgressIndicator.cancel(); } myCallback.tellSearchIsStopped(curPageNumber); return; } if (myProgressIndicator != null && myProgressIndicator.isCanceled()) { this.shouldStop(); myCallback.tellSearchIsStopped(curPageNumber); return; } /* preparing data for searching in next page if it's possible*/ pagesAmount = fileDataProviderForSearch.getPagesAmount(); if (options.searchForwardDirection) { curPageNumber++; prevPageText = curPageText; curPageText = nextPageText; nextPageText = curPageNumber < pagesAmount - 1 ? fileDataProviderForSearch.getPage_wait(curPageNumber + 1).getText() : ""; } else { curPageNumber--; nextPageText = curPageText; curPageText = prevPageText; prevPageText = curPageNumber > 0 ? fileDataProviderForSearch.getPage_wait(curPageNumber - 1).getText() : ""; } /* checking if it is the end... */ if (isTheEndOfSearchingCycle(curPageNumber, pagesAmount, options)) { myCallback.tellSearchIsFinished(this, getPreviousPageNumber(curPageNumber, options)); return; } if (isShouldStop()) { if (myProgressIndicator != null) { myProgressIndicator.cancel(); } myCallback.tellSearchIsStopped(curPageNumber); return; } if (myProgressIndicator != null && myProgressIndicator.isCanceled()) { this.shouldStop(); myCallback.tellSearchIsStopped(curPageNumber); return; } /* preparing addictive data */ tailText = getTailFromPage(nextPageText, tailLength); prefixSymbol = getPrefixSymbol(prevPageText); postfixSymbol = getPostfixSymbol(nextPageText, tailLength); } } catch (IOException e) { logger.warn(e); myCallback.tellSearchCatchedException(this, e); } }