PsiClass (@NotNull final MoveInnerOptions options) { PsiClass innerClass = options.getInnerClass(); PsiClass newClass; if (options.getTargetContainer() instanceof PsiDirectory) { newClass = createNewClass(options); PsiDocComment defaultDocComment = newClass.getDocComment(); if (defaultDocComment != null && innerClass.getDocComment() == null) { final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(defaultDocComment.getProject()); innerClass = (PsiClass)codeStyleManager.reformat(innerClass.addAfter(defaultDocComment, null).getParent()); } newClass = (PsiClass)newClass.replace(innerClass); PsiUtil.setModifierProperty(newClass, PsiModifier.STATIC, false); PsiUtil.setModifierProperty(newClass, PsiModifier.PRIVATE, false); PsiUtil.setModifierProperty(newClass, PsiModifier.PROTECTED, false); final boolean makePublic = needPublicAccess(options.getOuterClass(), options.getTargetContainer()); if (makePublic) { PsiUtil.setModifierProperty(newClass, PsiModifier.PUBLIC, true); } } else { newClass = (PsiClass)options.getTargetContainer().add(innerClass); } newClass.setName(options.getNewClassName()); return newClass; }