void (@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { if (elements.length != 1) return; final PsiClass aClass = (PsiClass)elements[0]; Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (aClass.isInterface()) { String message = RefactoringBundle.getCannotRefactorMessage(JavaRefactoringBundle.message("class.is.interface", aClass.getQualifiedName())); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.INHERITANCE_TO_DELEGATION); return; } if (aClass instanceof JspClass) { RefactoringMessageUtil.showNotSupportedForJspClassesError(project, editor, getRefactoringName(), HelpID.INHERITANCE_TO_DELEGATION); return; } if (!CommonRefactoringUtil.checkReadOnlyStatus(project, aClass)) return; PsiClass[] bases = aClass.getSupers(); @NonNls final String javaLangObject = CommonClassNames.JAVA_LANG_OBJECT; if (bases.length == 0 || bases.length == 1 && javaLangObject.equals(bases[0].getQualifiedName())) { String message = RefactoringBundle.getCannotRefactorMessage( JavaRefactoringBundle.message("class.does.not.have.base.classes.or.interfaces", aClass.getQualifiedName())); CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.INHERITANCE_TO_DELEGATION); return; } final HashMap<PsiClass, Collection<MemberInfo>> basesToMemberInfos = new LinkedHashMap<>(); for (PsiClass base : bases) { if (javaLangObject.equals(base.getQualifiedName())) continue; basesToMemberInfos.put(base, createBaseClassMemberInfos(base)); } final Set<PsiClass> baseClasses = basesToMemberInfos.keySet(); new InheritanceToDelegationDialog(project, aClass, baseClasses.toArray(PsiClass.EMPTY_ARRAY), basesToMemberInfos).show(); }