use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class LanguageLevelCombo method reset.
public void reset(@NotNull Project project) {
removeAllItems();
for (LanguageLevel level : LanguageLevel.values()) {
addItem(level);
}
Sdk sdk = ProjectRootManagerEx.getInstanceEx(project).getProjectSdk();
sdkUpdated(sdk, project.isDefault());
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(project);
if (extension.isDefault()) {
setSelectedItem(myDefaultItem);
} else {
setSelectedItem(extension.getLanguageLevel());
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class GradleProjectImportBuilder 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;
}
final LanguageLevel externalLanguageLevel = javaProjectNode.getData().getLanguageLevel();
final LanguageLevelProjectExtension languageLevelExtension = LanguageLevelProjectExtension.getInstance(project);
if (externalLanguageLevel != languageLevelExtension.getLanguageLevel()) {
languageLevelExtension.setLanguageLevel(externalLanguageLevel);
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class UnnecessaryReturnInspectionTest method test.
public void test() throws Exception {
final UnnecessaryReturnInspection inspection = new UnnecessaryReturnInspection();
inspection.ignoreInThenBranch = true;
final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
final LanguageLevel level = levelProjectExtension.getLanguageLevel();
try {
levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
doTest("com/siyeh/igtest/controlflow/unnecessary_return", new LocalInspectionToolWrapper(inspection), "java 1.8");
} finally {
levelProjectExtension.setLanguageLevel(level);
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.
the class CompletionStyleTest method testAfterNew15.
public void testAfterNew15() throws Exception {
final LanguageLevelProjectExtension ll = LanguageLevelProjectExtension.getInstance(getProject());
final LanguageLevel old = ll.getLanguageLevel();
ll.setLanguageLevel(LanguageLevel.JDK_1_5);
try {
final String path = BASE_PATH;
configureByFile(path + "/AfterNew15.java");
performSmartCompletion();
select('\n', getSelected());
checkResultByFile(path + "/AfterNew15-out.java");
} finally {
ll.setLanguageLevel(old);
}
}
use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij by bazelbuild.
the class BlazeAndroidSyncPlugin method setProjectSdkAndLanguageLevel.
private static void setProjectSdkAndLanguageLevel(final Project project, final Sdk sdk, final LanguageLevel javaLanguageLevel) {
UIUtil.invokeAndWaitIfNeeded((Runnable) () -> ApplicationManager.getApplication().runWriteAction(() -> {
ProjectRootManagerEx rootManager = ProjectRootManagerEx.getInstanceEx(project);
rootManager.setProjectSdk(sdk);
LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(project);
ext.setLanguageLevel(javaLanguageLevel);
}));
}
Aggregations