extracted method to get/set 'for generated source' option via API

This commit is contained in:
nik
2013-11-06 17:18:36 +04:00
parent 7b00b8f698
commit a95509a71c
15 changed files with 62 additions and 38 deletions
@@ -3,7 +3,6 @@ package com.intellij.openapi.roots;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.SourceFolderImpl;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiCodeFragment;
import com.intellij.psi.PsiFile;
@@ -39,8 +38,8 @@ public class JavaProjectRootsUtil {
for (Module module : ModuleManager.getInstance(project).getModules()) {
for (ContentEntry entry : ModuleRootManager.getInstance(module).getContentEntries()) {
for (SourceFolder sourceFolder : entry.getSourceFolders(JavaModuleSourceRootTypes.SOURCES)) {
JavaSourceRootProperties properties = (JavaSourceRootProperties)((SourceFolderImpl)sourceFolder).getJpsElement().getProperties();
if (!properties.isForGeneratedSources()) {
JavaSourceRootProperties properties = sourceFolder.getJpsElement().getProperties(JavaModuleSourceRootTypes.SOURCES);
if (properties != null && !properties.isForGeneratedSources()) {
ContainerUtil.addIfNotNull(roots, sourceFolder.getFile());
}
}