Search in sources :

Example 21 with SourceFolder

use of com.intellij.openapi.roots.SourceFolder in project android by JetBrains.

the class NonAndroidSourceTypeNode method getSourceFolders.

private List<VirtualFile> getSourceFolders() {
    ModuleRootManager rootManager = ModuleRootManager.getInstance(getValue());
    List<VirtualFile> folders = Lists.newArrayList();
    ContentEntry[] contentEntries = rootManager.getContentEntries();
    for (ContentEntry entry : contentEntries) {
        List<SourceFolder> sources = entry.getSourceFolders(mySourceType.rootType);
        for (SourceFolder folder : sources) {
            VirtualFile file = folder.getFile();
            if (file != null) {
                folders.add(file);
            }
        }
    }
    return folders;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SourceFolder(com.intellij.openapi.roots.SourceFolder) ContentEntry(com.intellij.openapi.roots.ContentEntry) ModuleRootManager(com.intellij.openapi.roots.ModuleRootManager)

Aggregations

SourceFolder (com.intellij.openapi.roots.SourceFolder)21 VirtualFile (com.intellij.openapi.vfs.VirtualFile)12 ContentEntry (com.intellij.openapi.roots.ContentEntry)7 Module (com.intellij.openapi.module.Module)6 ModuleRootManager (com.intellij.openapi.roots.ModuleRootManager)5 NotNull (org.jetbrains.annotations.NotNull)5 ExcludeFolder (com.intellij.openapi.roots.ExcludeFolder)3 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)3 JavaSourceRootProperties (org.jetbrains.jps.model.java.JavaSourceRootProperties)3 JpsModuleSourceRootType (org.jetbrains.jps.model.module.JpsModuleSourceRootType)3 Project (com.intellij.openapi.project.Project)2 ContentFolder (com.intellij.openapi.roots.ContentFolder)2 File (java.io.File)2 Assert.assertNotNull (junit.framework.Assert.assertNotNull)2 GuiTask (org.fest.swing.edt.GuiTask)2 Nullable (org.jetbrains.annotations.Nullable)2 JpsElement (org.jetbrains.jps.model.JpsElement)2 JpsModuleSourceRoot (org.jetbrains.jps.model.module.JpsModuleSourceRoot)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 GradleUtil.getGradleBuildFile (com.android.tools.idea.gradle.util.GradleUtil.getGradleBuildFile)1