@Override
  public void invoke(@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) {
    PsiElement parent = PsiTreeUtil.findCommonParent(elements);
    PsiClass aClass = parent instanceof PsiClass parentClass
                      ? parentClass
                      : PsiTreeUtil.getParentOfType(parent, PsiClass.class, false);
    final Editor editor = dataContext != null ? CommonDataKeys.EDITOR.getData(dataContext) : null;
    if (aClass == null) {
      String message = RefactoringBundle.getCannotRefactorMessage(RefactoringBundle.message("the.caret.should.be.positioned.inside.a.class.to.push.members.from"));
      CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MEMBERS_PUSH_DOWN);
      return;
    }
    if (aClass instanceof JspClass) {
      String message = RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("refactoring.is.not.supported.for.jsp.classes"));
      CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MEMBERS_PUSH_DOWN);
      return;
    }
    if (aClass instanceof PsiAnonymousClass) {
      String message = JavaRefactoringBundle.message("class.is.anonymous.warning.message");
      CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MEMBERS_PUSH_DOWN);
      return;
    }
    if (aClass.hasModifierProperty(PsiModifier.FINAL)) {
      String message = JavaRefactoringBundle.message("class.is.final.warning.message");
      CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MEMBERS_PUSH_DOWN);
      return;
    }
    if (!CommonRefactoringUtil.checkReadOnlyStatus(project, aClass)) return;

    final Set<PsiElement> selectedMembers = new HashSet<>();
    Collections.addAll(selectedMembers, elements);
    MemberInfoStorage memberInfoStorage = new MemberInfoStorage(aClass, element -> !(element instanceof PsiEnumConstant));
    List<MemberInfo> members = memberInfoStorage.getClassMemberInfos(aClass);
    for (MemberInfo memberInfo : members) {
      if (selectedMembers.contains(memberInfo.getMember())) {
        memberInfo.setChecked(true);
      }
    }
    PushDownDialog dialog = new PushDownDialog(project, members.toArray(new MemberInfo[0]), aClass);
    dialog.show();
  }
@Override
  public void invoke(@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext)