void (@NotNull DataContext dataContext, @Nullable FindModel model) { final FindManager findManager = FindManager.getInstance(myProject); final FindModel findModel; final boolean isOpenInNewTabEnabled; final boolean toOpenInNewTab; final Content selectedContent = UsageViewContentManager.getInstance(myProject).getSelectedContent(true); if (selectedContent != null && selectedContent.isPinned()) { toOpenInNewTab = true; isOpenInNewTabEnabled = false; } else { toOpenInNewTab = FindSettings.getInstance().isShowResultsInSeparateView(); isOpenInNewTabEnabled = UsageViewContentManager.getInstance(myProject).getReusableContentsCount() > 0; } if (model == null) { findModel = findManager.getFindInProjectModel().clone(); findModel.setReplaceState(true); findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled); findModel.setOpenInNewTab(toOpenInNewTab); FindInProjectUtil.setScope(myProject, findModel, dataContext); FindInProjectUtil.initStringToFindFromDataContext(findModel, dataContext); } else { findModel = model; findModel.setOpenInNewTabEnabled(isOpenInNewTabEnabled); } findManager.showFindDialog(findModel, () -> { if (findModel.isReplaceState()) { replaceInPath(findModel); } else { FindInProjectManager.getInstance(myProject).findInPath(findModel); } }); }