void (@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { myProject = project; PsiElement parent = PsiTreeUtil.findCommonParent(elements); PsiClass aClass = parent instanceof PsiClass parentClass ? parentClass : PsiTreeUtil.getParentOfType(parent, PsiClass.class, false); if (aClass == null) { String message = RefactoringBundle.message("error.select.class.to.be.refactored"); CommonRefactoringUtil.showErrorHint(project, null, message, getRefactoringName(), HelpID.MEMBERS_PULL_UP); return; } final Set<PsiElement> selectedMembers = new HashSet<>(); Collections.addAll(selectedMembers, elements); invoke(dataContext, aClass, selectedMembers); }