use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class CreateSwitchTest method doTestString.
private void doTestString() {
final LanguageLevelProjectExtension languageLevelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
final LanguageLevel oldLanguageLevel = languageLevelProjectExtension.getLanguageLevel();
languageLevelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_7);
try {
doTest();
} finally {
languageLevelProjectExtension.setLanguageLevel(oldLanguageLevel);
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class LambdaPostfixTemplateTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(myFixture.getProject());
myDefaultLanguageLevel = levelProjectExtension.getLanguageLevel();
levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project android by JetBrains.
the class NewProjectTest method testLanguageLevelForApi21.
@Test
public void testLanguageLevelForApi21() {
newProject("Test Application").withBriefNames().withMinSdk("21").create();
AndroidModuleModel appAndroidModel = guiTest.ideFrame().getAndroidProjectForModule("app");
assertThat(appAndroidModel.getAndroidProject().getDefaultConfig().getProductFlavor().getMinSdkVersion().getApiString()).named("minSdkVersion API").isEqualTo("21");
assertThat(appAndroidModel.getJavaLanguageLevel()).named("Gradle Java language level").isSameAs(LanguageLevel.JDK_1_7);
LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(guiTest.ideFrame().getProject());
assertThat(projectExt.getLanguageLevel()).named("Project Java language level").isSameAs(LanguageLevel.JDK_1_7);
for (Module module : ModuleManager.getInstance(guiTest.ideFrame().getProject()).getModules()) {
LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtensionImpl.getInstance(module);
assertThat(moduleExt.getLanguageLevel()).named("Gradle Java language level in module " + module.getName()).isSameAs(LanguageLevel.JDK_1_7);
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project android by JetBrains.
the class PostProjectBuildTasksExecutor method syncJavaLangLevel.
private void syncJavaLangLevel() {
Boolean updateJavaLangLevel = myProject.getUserData(UPDATE_JAVA_LANG_LEVEL_AFTER_BUILD);
if (updateJavaLangLevel == null || !updateJavaLangLevel.booleanValue()) {
return;
}
myProject.putUserData(UPDATE_JAVA_LANG_LEVEL_AFTER_BUILD, null);
executeProjectChangeAction(true, new DisposeAwareProjectChange(myProject) {
@Override
public void execute() {
if (myProject.isOpen()) {
//noinspection TestOnlyProblems
LanguageLevel langLevel = getMaxJavaLangLevel();
if (langLevel != null) {
LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(myProject);
if (langLevel != ext.getLanguageLevel()) {
ext.setLanguageLevel(langLevel);
}
}
}
}
});
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project liferay-ide by liferay.
the class LiferayGradleProjectImportBuilder method beforeCommit.
@Override
protected void beforeCommit(@NotNull DataNode<ProjectData> dataNode, @NotNull Project project) {
DataNode<JavaProjectData> javaProjectNode = ExternalSystemApiUtil.find(dataNode, JavaProjectData.KEY);
if (javaProjectNode == null) {
return;
}
JavaProjectData javaProjectData = javaProjectNode.getData();
LanguageLevel externalLanguageLevel = javaProjectData.getLanguageLevel();
LanguageLevelProjectExtension languageLevelExtension = LanguageLevelProjectExtension.getInstance(project);
if (externalLanguageLevel != languageLevelExtension.getLanguageLevel()) {
languageLevelExtension.setLanguageLevel(externalLanguageLevel);
}
}
Aggregations