void (final Set<PsiFile> searchIn, final Set<PsiFile> searchFor) { cancelCurrentFindRequest(); myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> ApplicationManager.getApplication().executeOnPooledThread(() -> { final ProgressIndicator progress = new PanelProgressIndicator(component -> setToComponent(component)); myCurrentProgress = progress; ProgressManager.getInstance().runProcess(() -> { ApplicationManager.getApplication().runReadAction(() -> { UsageInfo[] usages = UsageInfo.EMPTY_ARRAY; Set<PsiFile> elementsToSearch = null; try { if (myBuilders.get(0).isBackward()){ elementsToSearch = searchIn; usages = FindDependencyUtil.findBackwardDependencies(myBuilders, searchFor, searchIn); } else { elementsToSearch = searchFor; usages = FindDependencyUtil.findDependencies(myBuilders, searchIn, searchFor); } assert !new HashSet<>(elementsToSearch).contains(null); } catch (ProcessCanceledException e) { } catch (Exception e) { LOG.error(e); } if (!progress.isCanceled()) { final UsageInfo[] finalUsages = usages; final PsiElement[] _elementsToSearch = elementsToSearch != null ? PsiUtilCore.toPsiElementArray(elementsToSearch) : PsiElement.EMPTY_ARRAY; ApplicationManager.getApplication().invokeLater(() -> showUsages(_elementsToSearch, finalUsages), ModalityState.stateForComponent( this)); } }); myCurrentProgress = null; }, progress); }), 300); }