use of com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl in project intellij-community by JetBrains.
the class IdeaTestUtil method setModuleLanguageLevel.
public static void setModuleLanguageLevel(Module module, final LanguageLevel level) {
final LanguageLevelModuleExtensionImpl modifiable = (LanguageLevelModuleExtensionImpl) LanguageLevelModuleExtensionImpl.getInstance(module).getModifiableModel(true);
modifiable.setLanguageLevel(level);
modifiable.commit();
}
use of com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStep method doSetUpModule.
@Override
protected void doSetUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull JavaModuleModel javaModuleModel, @Nullable SyncAction.ModuleModels gradleModels, @Nullable ProgressIndicator indicator) {
LanguageLevel languageLevel = javaModuleModel.getJavaLanguageLevel();
if (languageLevel == null) {
// Java language is still not correct. Most likely this module does not have dependents.
// Get minimum language level from all Android modules.
languageLevel = getMinimumLanguageLevelForAndroidModules(ideModelsProvider);
}
if (languageLevel == null) {
// The minimum safe Java language level.
languageLevel = JDK_1_6;
}
ModifiableRootModel rootModel = ideModelsProvider.getModifiableRootModel(module);
LanguageLevelModuleExtensionImpl moduleExtension = rootModel.getModuleExtension(LanguageLevelModuleExtensionImpl.class);
moduleExtension.setLanguageLevel(languageLevel);
}
use of com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStepTest method verifyLanguageLevel.
private static void verifyLanguageLevel(@NotNull Module module, @NotNull LanguageLevel expected) {
ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
LanguageLevelModuleExtensionImpl moduleExtension = modifiableModel.getModuleExtension(LanguageLevelModuleExtensionImpl.class);
try {
assertEquals(expected, moduleExtension.getLanguageLevel());
} finally {
modifiableModel.dispose();
}
}
use of com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl in project android by JetBrains.
the class JavaLanguageLevelModuleSetupStepTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initMocks(this);
mySetupStep = new JavaLanguageLevelModuleSetupStep();
// Set the module's Java language level to 1.5 to check it changed.
Module module = getModule();
ModifiableRootModel modifiableModel = ModuleRootManager.getInstance(module).getModifiableModel();
LanguageLevelModuleExtensionImpl moduleExtension = modifiableModel.getModuleExtension(LanguageLevelModuleExtensionImpl.class);
moduleExtension.setLanguageLevel(JDK_1_5);
ApplicationManager.getApplication().runWriteAction(modifiableModel::commit);
}
Aggregations