use of com.intellij.openapi.roots.ModifiableRootModel 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.ModifiableRootModel in project android by JetBrains.
the class ContentRootModuleSetupStep method gradleModelNotFound.
@Override
protected void gradleModelNotFound(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider) {
ModifiableRootModel moduleModel = ideModelsProvider.getModifiableRootModel(module);
removeExistingContentEntries(moduleModel);
}
use of com.intellij.openapi.roots.ModifiableRootModel in project android by JetBrains.
the class DependenciesModuleSetupStepTest method createContentRoot.
private static void createContentRoot(@NotNull Module module) {
VirtualFile moduleFolder = getModuleFolder(module);
ModifiableRootModel modifiableRootModel = ModuleRootManager.getInstance(module).getModifiableModel();
modifiableRootModel.addContentEntry(moduleFolder);
ApplicationManager.getApplication().runWriteAction(modifiableRootModel::commit);
}
use of com.intellij.openapi.roots.ModifiableRootModel 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.ModifiableRootModel in project android by JetBrains.
the class ProjectResourceRepositoryTest method addModuleDependency.
private static void addModuleDependency(Module from, Module to) {
final ModifiableRootModel model = ModuleRootManager.getInstance(from).getModifiableModel();
model.addModuleOrderEntry(to);
ApplicationManager.getApplication().runWriteAction(model::commit);
}
Aggregations