当前位置: 首页>>代码示例>>Java>>正文


Java LanguageLevelProjectExtension.getLanguageLevel方法代码示例

本文整理汇总了Java中com.intellij.openapi.roots.LanguageLevelProjectExtension.getLanguageLevel方法的典型用法代码示例。如果您正苦于以下问题:Java LanguageLevelProjectExtension.getLanguageLevel方法的具体用法?Java LanguageLevelProjectExtension.getLanguageLevel怎么用?Java LanguageLevelProjectExtension.getLanguageLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.roots.LanguageLevelProjectExtension的用法示例。


在下文中一共展示了LanguageLevelProjectExtension.getLanguageLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectSdk

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
private void selectSdk(@NotNull final Project project) {
    Validate.notNull(project);

    final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project);

    final Sdk projectSdk = projectRootManager.getProjectSdk();

    if (null == projectSdk) {
        return;
    }

    if (StringUtils.isNotBlank(projectSdk.getVersionString())) {
        final JavaSdkVersion sdkVersion = JdkVersionUtil.getVersion(projectSdk.getVersionString());
        final LanguageLevelProjectExtension languageLevelExt = LanguageLevelProjectExtension.getInstance(project);

        if (sdkVersion.getMaxLanguageLevel() != languageLevelExt.getLanguageLevel()) {
            languageLevelExt.setLanguageLevel(sdkVersion.getMaxLanguageLevel());
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:ImportProjectProgressModalWindow.java

示例2: testEnum1

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testEnum1() throws Exception
{
    final Project project = getProject();
    final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
    LanguageLevel oldLevel = llpExtension.getLanguageLevel();
    llpExtension.setLanguageLevel(LanguageLevel.JDK_1_5);
    configureByFile("/com/wrq/rearranger/Enum1Test.java");
    final PsiFile file = getFile();
    final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
    rs = RearrangerSettings.getSettingsFromFile(new File(InteractiveTest.DEFAULT_CONFIGURATION));
    rs.setAskBeforeRearranging(false);
    rs.getNewlinesAtEOF().setForce(true);
    rs.getNewlinesAtEOF().setnBlankLines(1);
    rs.setRearrangeInnerClasses(true);
    rs.getExtractedMethodsSettings().setBelowFirstCaller(true);
    final RearrangerActionHandler rah = new RearrangerActionHandler();
    rah.rearrangeDocument(project, file, rs, doc);
    super.checkResultByFile("/com/wrq/rearranger/Enum1Result.java");
    llpExtension.setLanguageLevel(oldLevel);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:21,代码来源:RearrangerTest.java

示例3: testEnum2

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testEnum2() throws Exception
{
    final Project project = getProject();
    final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
    LanguageLevel oldLevel = llpExtension.getLanguageLevel();
    llpExtension.setLanguageLevel(LanguageLevel.JDK_1_5);
    configureByFile("/com/wrq/rearranger/Enum2Test.java");
    final PsiFile file = getFile();
    final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
    rs = RearrangerSettings.getSettingsFromFile(new File(InteractiveTest.DEFAULT_CONFIGURATION));
    rs.setAskBeforeRearranging(false);
    rs.setRearrangeInnerClasses(true);
    rs.getAfterClassRBrace().setForce(false);
    final RearrangerActionHandler rah = new RearrangerActionHandler();
    rah.rearrangeDocument(project, file, rs, doc);
    super.checkResultByFile("/com/wrq/rearranger/Enum2Result.java");
    llpExtension.setLanguageLevel(oldLevel);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:19,代码来源:RearrangerTest.java

示例4: testEnum2A

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testEnum2A() throws Exception
{
    final Project project = getProject();
    final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
    LanguageLevel oldLevel = llpExtension.getLanguageLevel();
    llpExtension.setLanguageLevel(LanguageLevel.JDK_1_5);
    configureByFile("/com/wrq/rearranger/Enum2Test.java");
    final PsiFile file = getFile();
    final Document doc = PsiDocumentManager.getInstance(project).getDocument(file);
    rs = RearrangerSettings.getSettingsFromFile(new File(InteractiveTest.DEFAULT_CONFIGURATION));
    rs.setAskBeforeRearranging(false);
    rs.setRearrangeInnerClasses(false);
    rs.getAfterClassRBrace().setForce(false);
    final RearrangerActionHandler rah = new RearrangerActionHandler();
    rah.rearrangeDocument(project, file, rs, doc);
    super.checkResultByFile("/com/wrq/rearranger/Enum2AResult.java");
    llpExtension.setLanguageLevel(oldLevel);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:19,代码来源:RearrangerTest.java

示例5: testEnumSelection

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testEnumSelection() throws Exception
{
    configureByFile("/com/wrq/rearranger/RearrangementTest47.java");
    final PsiFile file = getFile();
    final Project project = getProject();
    final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
    LanguageLevel oldLevel = llpExtension.getLanguageLevel();
    llpExtension.setLanguageLevel(LanguageLevel.JDK_1_5);
    final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
    final RearrangerActionHandler rah = new RearrangerActionHandler();
    FieldAttributes fa = new FieldAttributes();
    fa.getStAttr().setValue(true);
    rs.addItem(fa, 0);
    InnerClassAttributes ica = new InnerClassAttributes();
    ica.getEnumAttr().setValue(true);
    rs.addItem(ica, 1);
    rah.rearrangeDocument(getProject(), file, rs, doc);
    super.checkResultByFile("/com/wrq/rearranger/RearrangementResult47.java");
    llpExtension.setLanguageLevel(oldLevel);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:21,代码来源:RearrangerTest.java

示例6: testAfterNew15

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CompletionStyleTest.java

示例7: testEnumClass

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public final void testEnumClass() throws Exception
{
    final Project project = getProject();
    final LanguageLevelProjectExtension llpExtension = LanguageLevelProjectExtension.getInstance(project);
    LanguageLevel oldLevel = llpExtension.getLanguageLevel();
    llpExtension.setLanguageLevel(LanguageLevel.JDK_1_5);
    configureByFile("/com/wrq/rearranger/RearrangementTest42.java");
    final PsiFile file = getFile();
    final Document doc = PsiDocumentManager.getInstance(getProject()).getDocument(file);
    final RearrangerActionHandler rah = new RearrangerActionHandler();
    rah.rearrangeDocument(getProject(), file, rs, doc);
    super.checkResultByFile("/com/wrq/rearranger/RearrangementResult42.java");
    llpExtension.setLanguageLevel(oldLevel);
}
 
开发者ID:DaveKriewall,项目名称:Rearranger,代码行数:15,代码来源:RearrangerTest.java

示例8: withLevel

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:IdeaTestUtil.java

示例9: doTestString

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CreateSwitchTest.java

示例10: testStaticToInterface

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MoveMembersTest.java

示例11: testFromNestedToOuterMethodRef

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:MoveMembersTest.java

示例12: testLanguageLevel

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testLanguageLevel() throws Exception {
  final LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(getProject());
  final LanguageLevel languageLevel = extension.getLanguageLevel();
  try {
    extension.setLanguageLevel(LanguageLevel.JDK_1_3);
    doTestFieldType("i", PsiType.INT, myJavaFacade.getElementFactory().createTypeFromText("java.lang.ThreadLocal", null));
  }
  finally {
    extension.setLanguageLevel(languageLevel);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:TypeMigrationByThreadLocalRuleTest.java

示例13: beforeCommit

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
@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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GradleProjectImportBuilder.java

示例14: testMethodReferenceIgnored

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void testMethodReferenceIgnored() throws Exception {
  final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject());
  final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
  try {
    projectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
    doTest();
  }
  finally {
    projectExtension.setLanguageLevel(oldLevel);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BooleanMethodInvertedTest.java

示例15: test

import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public void test() throws Exception {
  final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
  final LanguageLevel level = levelProjectExtension.getLanguageLevel();
  try {
    levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
    doTest("com/siyeh/igtest/inheritance/interface_never_implemented",
           new LocalInspectionToolWrapper(new InterfaceNeverImplementedInspection()), "java 1.8");
  }
  finally {
    levelProjectExtension.setLanguageLevel(level);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:InterfaceNeverImplementedInspectionTest.java


注:本文中的com.intellij.openapi.roots.LanguageLevelProjectExtension.getLanguageLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。