void () { ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> ApplicationManager.getApplication().runReadAction(() -> searchExistingImplementations()), CodeInsightBundle.message("searching.for.implementations"), false, myProject); if (mySourceMethods.isEmpty()) { Messages.showErrorDialog(myProject, JavaBundle.message("copy.abstract.method.no.existing.implementations.found"), JavaBundle.message("copy.abstract.method.title")); return; } if (mySourceMethods.size() == 1) { copyImplementation(mySourceMethods.get(0)); } else { mySourceMethods.sort((o1, o2) -> { PsiClass c1 = o1.getContainingClass(); PsiClass c2 = o2.getContainingClass(); return Comparing.compare(c1.getName(), c2.getName()); }); JBPopupFactory.getInstance() .createPopupChooserBuilder(mySourceMethods) .setRenderer(new MethodCellRenderer(true)) .setItemChosenCallback((element) -> copyImplementation(element)) .setTitle(JavaBundle.message("copy.abstract.method.popup.title")) .createPopup() .showInBestPositionFor(myEditor); } }