Search in sources :

Example 61 with ContentEntry

use of com.intellij.openapi.roots.ContentEntry in project Intellij-Plugin by getgauge.

the class GaugeLibHelper method checkProjectSourceAndOutputDirectory.

private void checkProjectSourceAndOutputDirectory(ModifiableRootModel modifiableModel) {
    VirtualFile[] sourceRoots = modifiableModel.getSourceRoots();
    if (sourceRoots.length < 1) {
        ContentEntry contentEntry = modifiableModel.addContentEntry(modifiableModel.getProject().getBaseDir());
        VirtualFile srcPath = srcPath(modifiableModel);
        if (srcPath != null) {
            contentEntry.addSourceFolder(srcPath, false);
        }
        CompilerModuleExtension compilerModuleExtension = modifiableModel.getModuleExtension(CompilerModuleExtension.class);
        compilerModuleExtension.setCompilerOutputPath(outputPath(modifiableModel.getModule()));
        compilerModuleExtension.setCompilerOutputPathForTests(testOutputPath(modifiableModel.getModule()));
        compilerModuleExtension.inheritCompilerOutputPath(false);
        compilerModuleExtension.commit();
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentEntry(com.intellij.openapi.roots.ContentEntry) CompilerModuleExtension(com.intellij.openapi.roots.CompilerModuleExtension)

Aggregations

ContentEntry (com.intellij.openapi.roots.ContentEntry)61 VirtualFile (com.intellij.openapi.vfs.VirtualFile)28 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)27 Module (com.intellij.openapi.module.Module)17 File (java.io.File)16 ModuleRootManager (com.intellij.openapi.roots.ModuleRootManager)11 SourceFolder (com.intellij.openapi.roots.SourceFolder)7 NotNull (org.jetbrains.annotations.NotNull)7 FilePaths.findParentContentEntry (com.android.tools.idea.gradle.util.FilePaths.findParentContentEntry)4 IOException (java.io.IOException)4 Nullable (org.jetbrains.annotations.Nullable)4 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)3 Project (com.intellij.openapi.project.Project)3 CompilerModuleExtension (com.intellij.openapi.roots.CompilerModuleExtension)3 JavaModuleContentRoot (com.android.tools.idea.gradle.model.java.JavaModuleContentRoot)2 NodeDescriptor (com.intellij.ide.util.treeView.NodeDescriptor)2 ModifiableFlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.ModifiableFlexBuildConfiguration)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2 PsiFile (com.intellij.psi.PsiFile)2 ArrayList (java.util.ArrayList)2