void (@NotNull final Project project, final Editor editor, PsiFile file, DataContext dataContext) { final int offset = editor.getCaretModel().getOffset(); final PsiElement element = file.findElementAt(offset); final PsiMember member = PsiTreeUtil.getParentOfType(element, PsiMember.class); final String cannotRefactorMessage = getCannotRefactorMessage(member); if (cannotRefactorMessage != null) { String message = RefactoringBundle.getCannotRefactorMessage(cannotRefactorMessage); showErrorMessage(message, project, editor); return; } final AnalysisScope scope = new AnalysisScope(file); final Module module = ModuleUtilCore.findModuleForPsiElement(file); final BaseAnalysisActionDialog dlg = new BaseAnalysisActionDialog(JavaRefactoringBundle.message("replace.method.duplicates.scope.chooser.title", getRefactoringName()), JavaRefactoringBundle.message("replace.method.duplicates.scope.chooser.message"), project, BaseAnalysisActionDialog.standardItems(project, scope, module, element), AnalysisUIOptions.getInstance(project), false); if (dlg.showAndGet()) { AnalysisScope selectedScope = dlg.getScope(scope); ProgressManager.getInstance().run(new Task.Backgroundable(project, JavaRefactoringBundle.message("locate.duplicates.action.name"), true) { @Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); invokeOnScope(project, member, selectedScope); } }); } }