void (PsiClass aClass) { WriteCommandAction.writeCommandAction(aClass.getProject()).withName(getTitle(aClass)).withGroupId(getTitle(aClass)).run(() -> { final PsiClass containingClass = aClass.getContainingClass(); LOG.assertTrue(containingClass != null); final PsiTypeParameterList oldTypeParameterList = aClass.getTypeParameterList(); PsiClass classFromText = JavaPsiFacade.getElementFactory(aClass.getProject()).createClass( suggestTargetClassName(aClass)); classFromText = (PsiClass)containingClass.addAfter(classFromText, aClass); startTemplate(oldTypeParameterList, aClass.getProject(), aClass, classFromText, true); }); }