private static @Nullable List<PsiElementClassMember<?>> sortedSelection(PsiElementClassMember<?>[] dialogMembers,
                                                                          MemberChooser<PsiElementClassMember<?>> chooser) {
    List<PsiElementClassMember<?>> selectedElements = chooser.getSelectedElements();
    if (selectedElements == null) {
      return null;
    }
    return GenerateToStringContext.getConfig().getSortElements() == 0
           ? selectedElements
           : ContainerUtil.filter(dialogMembers, selectedElements::contains);
  }
private static @Nullable List<PsiElementClassMember<?>> sortedSelection(PsiElementClassMember<?>[] dialogMembers,
                                                                          MemberChooser<PsiElementClassMember<?>> chooser)