void () { LOG.debug("Search task started for contributor ", myContributor); SearchingProcessStatisticsCollector.searchStarted(myContributor); try { boolean repeat; do { ProgressIndicator wrapperIndicator = new SensitiveProgressWrapper(myIndicator); try { if (myContributor instanceof WeightedSearchEverywhereContributor) { ((WeightedSearchEverywhereContributor<Item>)myContributor).fetchWeightedElements(myPattern, wrapperIndicator, descriptor -> processFoundItem( descriptor.getItem(), descriptor.getWeight(), wrapperIndicator)); } else { myContributor.fetchElements(myPattern, wrapperIndicator, element -> { int priority = myContributor .getElementPriority(Objects.requireNonNull(element), myPattern); return processFoundItem(element, priority, wrapperIndicator); }); } } catch (ProcessCanceledException ignore) {} repeat = !myIndicator.isCanceled() && wrapperIndicator.isCanceled(); } while (repeat); if (myIndicator.isCanceled()) { return; } myAccumulator.contributorFinished(myContributor); } finally { finishCallback.run(); } LOG.debug("Search task finished for contributor ", myContributor); }