MoveToPackageFix (@Nullable PsiFile myFile, @Nullable String targetPackage) { if (myFile == null || !myFile.isValid() || !myFile.getManager().isInProject(myFile) || !(myFile instanceof PsiJavaFile) || ((PsiJavaFile)myFile).getClasses().length == 0 || targetPackage == null) { return null; } return new MoveToPackageFix(myFile, targetPackage); }