Search in sources :

Example 6 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class IntroduceParameterObjectTest method testTypeParametersWithSubstitution.

public void testTypeParametersWithSubstitution() throws Exception {
    final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
    try {
        projectExtension.setLanguageLevel(LanguageLevel.HIGHEST);
        doTest();
    } finally {
        projectExtension.setLanguageLevel(oldLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 7 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class MoveMembersTest method testFromNestedToOuterMethodRef.

public void testFromNestedToOuterMethodRef() throws Exception {
    final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
    try {
        projectExtension.setLanguageLevel(LanguageLevel.HIGHEST);
        doTest("Outer.Inner", "Outer", true, VisibilityUtil.ESCALATE_VISIBILITY, 0);
    } finally {
        projectExtension.setLanguageLevel(oldLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 8 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class MoveMembersTest method testStaticToInterface.

public void testStaticToInterface() throws Exception {
    final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel level = levelProjectExtension.getLanguageLevel();
    try {
        levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
        doTest("A", "B", 0);
    } finally {
        levelProjectExtension.setLanguageLevel(level);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 9 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class IdeaTestUtil method withLevel.

public static void withLevel(final Module module, final LanguageLevel level, final Runnable r) {
    final LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(module.getProject());
    final LanguageLevel projectLevel = projectExt.getLanguageLevel();
    final LanguageLevel moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
    try {
        projectExt.setLanguageLevel(level);
        setModuleLanguageLevel(module, level);
        r.run();
    } finally {
        setModuleLanguageLevel(module, moduleLevel);
        projectExt.setLanguageLevel(projectLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 10 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class ProjectConfigurable method isModified.

@Override
@SuppressWarnings({ "SimplifiableIfStatement" })
public boolean isModified() {
    LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
    if (extension.isDefault() != myLanguageLevelCombo.isDefault() || !extension.isDefault() && !extension.getLanguageLevel().equals(myLanguageLevelCombo.getSelectedLevel())) {
        return true;
    }
    final String compilerOutput = getOriginalCompilerOutputUrl();
    if (!Comparing.strEqual(FileUtil.toSystemIndependentName(VfsUtilCore.urlToPath(compilerOutput)), FileUtil.toSystemIndependentName(myProjectCompilerOutput.getText())))
        return true;
    if (myProjectJdkConfigurable.isModified())
        return true;
    if (!getProjectName().equals(myProject.getName()))
        return true;
    return false;
}
Also used : LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Aggregations

LanguageLevelProjectExtension (com.intellij.openapi.roots.LanguageLevelProjectExtension)31 LanguageLevel (com.intellij.pom.java.LanguageLevel)23 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)3 DisposeAwareProjectChange (com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange)3 ProjectRootManagerEx (com.intellij.openapi.roots.ex.ProjectRootManagerEx)3 JavaProjectData (com.intellij.externalSystem.JavaProjectData)2 Module (com.intellij.openapi.module.Module)2 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ProjectEx (com.intellij.openapi.project.ex.ProjectEx)1 JavaSdkVersion (com.intellij.openapi.projectRoots.JavaSdkVersion)1 CompilerProjectExtension (com.intellij.openapi.roots.CompilerProjectExtension)1 LanguageLevelModuleExtension (com.intellij.openapi.roots.LanguageLevelModuleExtension)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 JavaModuleFixtureBuilder (com.intellij.testFramework.builders.JavaModuleFixtureBuilder)1 IdeaProjectTestFixture (com.intellij.testFramework.fixtures.IdeaProjectTestFixture)1 File (java.io.File)1 IOException (java.io.IOException)1