void (@NotNull UsageViewManager manager, @NotNull Factory<? extends UsageSearcher> usageSearcherFactory, @NotNull final FindModel findModelCopy, @NotNull UsageViewPresentation presentation, @NotNull FindUsagesProcessPresentation processPresentation) { presentation.setMergeDupLinesAvailable(false); final ReplaceInProjectTarget target = new ReplaceInProjectTarget(myProject, findModelCopy); ((FindManagerImpl)FindManager.getInstance(myProject)).getFindUsagesManager().addToHistory(target); final ReplaceContext[] context = new ReplaceContext[1]; manager.searchAndShowUsages(new UsageTarget[]{target}, usageSearcherFactory, processPresentation, presentation, new UsageViewManager.UsageViewStateListener() { @Override public void usageViewCreated(@NotNull UsageView usageView) { context[0] = new ReplaceContext(usageView, findModelCopy); addReplaceActions(context[0]); usageView.setRerunAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { UsageViewPresentation rerunPresentation = presentation.copy(); rerunPresentation.setOpenInNewTab(false); searchAndShowUsages(manager, usageSearcherFactory, findModelCopy, rerunPresentation, processPresentation); } }); } @Override public void findingUsagesFinished(final UsageView usageView) { if (context[0] != null && !processPresentation.isShowFindOptionsPrompt()) { ApplicationManager.getApplication().invokeLater(() -> { replaceUsagesUnderCommand(context[0], usageView.getUsages(), true); }, myProject.getDisposed()); } } }); }