@Nullable
 @Override
 protected ClassMember[] chooseMembers(
     ClassMember[] classMembers,
     boolean allowEmptySelection,
     boolean copyJavadocCheckbox,
     Project project,
     @Nullable Editor editor) {
   MemberChooser<ClassMember> chooser =
       new MemberChooser<ClassMember>(classMembers, allowEmptySelection, true, project);
   chooser.setTitle("Select Fields to Generate With Methods");
   chooser.setCopyJavadocVisible(copyJavadocCheckbox);
   chooser.show();
   myToCopyJavaDoc = chooser.isCopyJavadoc();
   List<ClassMember> list = chooser.getSelectedElements();
   return list == null ? null : list.toArray(new ClassMember[list.size()]);
 }
  @NotNull
  public static List<MavenDomDependency> chooseDependencies(
      Collection<MavenDomDependency> candidates, final Project project) {
    List<MavenDomDependency> dependencies = new ArrayList<MavenDomDependency>();

    MavenDomProjectModelMember[] memberCandidates =
        ContainerUtil.map2Array(
            candidates,
            MavenDomProjectModelMember.class,
            dependency -> new MavenDomProjectModelMember(dependency));
    MemberChooser<MavenDomProjectModelMember> chooser =
        new MemberChooser<MavenDomProjectModelMember>(memberCandidates, true, true, project) {
          protected ShowContainersAction getShowContainersAction() {
            return new ShowContainersAction(
                MavenDomBundle.message("chooser.show.project.files"), MavenIcons.MavenProject);
          }

          @NotNull
          @Override
          protected String convertElementText(@NotNull String originalElementText) {
            return originalElementText;
          }

          protected String getAllContainersNodeName() {
            return MavenDomBundle.message("all.dependencies");
          }
        };

    chooser.setTitle(MavenDomBundle.message("dependencies.chooser.title"));
    chooser.setCopyJavadocVisible(false);
    chooser.show();

    if (chooser.getExitCode() == MemberChooser.OK_EXIT_CODE) {
      final MavenDomProjectModelMember[] members =
          chooser.getSelectedElements(new MavenDomProjectModelMember[0]);
      if (members != null) {
        dependencies.addAll(
            ContainerUtil.mapNotNull(
                members, mavenDomProjectModelMember -> mavenDomProjectModelMember.getDependency()));
      }
    }

    return dependencies;
  }
  private void proceedWithChoosingMethods(
      Project project,
      PsiFile file,
      final Editor editor,
      List<CppMethodElementNode> candidates,
      boolean override) {
    final MemberChooser<CppMethodElementNode> chooser =
        new MemberChooser<CppMethodElementNode>(
            candidates.toArray(new CppMethodElementNode[candidates.size()]),
            false,
            true,
            project,
            false) {};

    chooser.setTitle("Choose Methods to " + (override ? "Override" : "Implement"));
    chooser.setCopyJavadocVisible(false);
    chooser.show();
    if (chooser.getExitCode() != DialogWrapper.OK_EXIT_CODE) return;
    final List<CppMethodElementNode> selectedElements = chooser.getSelectedElements();
    if (selectedElements == null || selectedElements.size() == 0) return;

    CommandProcessor.getInstance()
        .executeCommand(
            project,
            new Runnable() {
              public void run() {
                ApplicationManager.getApplication()
                    .runWriteAction(
                        new Runnable() {
                          public void run() {
                            Document document = editor.getDocument();
                            int offset = editor.getCaretModel().getOffset();

                            for (CppMethodElementNode c : selectedElements) {
                              String cType = c.getType();
                              String methodText =
                                  "virtual "
                                      + cType
                                      + " "
                                      + c.getText()
                                      + " {\n"
                                      + (!"void".equals(cType) ? "return " : "")
                                      + (c.myIsAbstract
                                          ? ""
                                          : c.getParentName()
                                              + "::"
                                              + c.myName
                                              + "("
                                              + c.myParamNames
                                              + ");")
                                      + "\n"
                                      + "}\n";
                              document.insertString(offset, methodText);
                              offset += methodText.length();
                            }
                          }
                        });
              }
            },
            override ? "Override Methods" : "Implement Methods",
            this);
  }