PsiElementClassMember (PsiFile file, Editor editor, Project project) { final PsiElementClassMember[] targetElements = getTargetElements(file, editor); if (targetElements == null || targetElements.length == 0) return null; if (!ApplicationManager.getApplication().isUnitTestMode()) { MemberChooser<PsiElementClassMember> chooser = new MemberChooser<>(targetElements, false, false, project); chooser.setTitle(JavaBundle.message("generate.delegate.target.chooser.title")); chooser.setCopyJavadocVisible(false); chooser.show(); if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) return null; final List<PsiElementClassMember> selectedElements = chooser.getSelectedElements(); if (selectedElements != null && selectedElements.size() > 0) return selectedElements.get(0); } else { return targetElements[0]; } return null; }