void (@NotNull File targetDir, final JavaSourceRootType rootType) { switch (myImportingSettings.getGeneratedSourcesFolder()) { case GENERATED_SOURCE_FOLDER -> myModel.addGeneratedJavaSourceFolder(targetDir.getPath(), rootType); case SUBFOLDER -> addAllSubDirsAsGeneratedSources(targetDir, rootType); case AUTODETECT -> { Collection<JavaModuleSourceRoot> sourceRoots = JavaSourceRootDetectionUtil.suggestRoots(targetDir); for (JavaModuleSourceRoot root : sourceRoots) { if (FileUtil.filesEqual(targetDir, root.getDirectory())) { myModel.addGeneratedJavaSourceFolder(targetDir.getPath(), rootType); return; } addAsGeneratedSourceFolder(root.getDirectory(), rootType); } addAllSubDirsAsGeneratedSources(targetDir, rootType); } case IGNORE -> { // Ignore. } } }