Search in sources :

Example 1 with DefaultLightProjectDescriptor

use of com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor in project intellij-plugins by JetBrains.

the class CucumberJavaTestUtil method createCucumberJava8ProjectDescriptor.

public static DefaultLightProjectDescriptor createCucumberJava8ProjectDescriptor() {
    return new DefaultLightProjectDescriptor() {

        @Override
        public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
            attachCucumberLibraries(module, model);
            LanguageLevelModuleExtension extension = model.getModuleExtension(LanguageLevelModuleExtension.class);
            if (extension != null) {
                extension.setLanguageLevel(LanguageLevel.JDK_1_8);
            }
            VirtualFile sourceRoot = VirtualFileManager.getInstance().refreshAndFindFileByUrl("temp:///src");
            if (sourceRoot != null) {
                contentEntry.removeSourceFolder(contentEntry.getSourceFolders()[0]);
                contentEntry.addSourceFolder(sourceRoot, true);
            }
        }
    };
}
Also used : ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentEntry(com.intellij.openapi.roots.ContentEntry) DefaultLightProjectDescriptor(com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor) Module(com.intellij.openapi.module.Module) LanguageLevelModuleExtension(com.intellij.openapi.roots.LanguageLevelModuleExtension) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Module (com.intellij.openapi.module.Module)1 ContentEntry (com.intellij.openapi.roots.ContentEntry)1 LanguageLevelModuleExtension (com.intellij.openapi.roots.LanguageLevelModuleExtension)1 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 DefaultLightProjectDescriptor (com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor)1 NotNull (org.jetbrains.annotations.NotNull)1