void (PsiElement newFile) { if (ApplicationManager.getApplication().isUnitTestMode()) return; // don't move classes to new files with corresponding class names and reformat if (!(newFile instanceof PsiJavaFile)) { LOG.info(".java is not assigned to java file type"); return; } newFile = JavaCodeStyleManager.getInstance(myProject).shortenClassReferences(newFile); newFile = CodeStyleManager.getInstance(myProject).reformat(newFile); PsiClass[] inner = ((PsiJavaFile)newFile).getClasses(); for (PsiClass psiClass : inner) { var fix = new MoveClassToSeparateFileFix(psiClass).asIntention(); if (fix.isAvailable(myProject, null, (PsiFile)newFile)) { fix.invoke(myProject, null, (PsiFile)newFile); } } }