本文整理汇总了Java中com.intellij.openapi.roots.LanguageLevelProjectExtension.setLanguageLevel方法的典型用法代码示例。如果您正苦于以下问题:Java LanguageLevelProjectExtension.setLanguageLevel方法的具体用法?Java LanguageLevelProjectExtension.setLanguageLevel怎么用?Java LanguageLevelProjectExtension.setLanguageLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.roots.LanguageLevelProjectExtension
的用法示例。
在下文中一共展示了LanguageLevelProjectExtension.setLanguageLevel方法的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例12: applyJdkToProject
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入方法依赖的package包/类
public static void applyJdkToProject(@NotNull Project project, @NotNull Sdk jdk) {
ProjectRootManagerEx rootManager = ProjectRootManagerEx.getInstanceEx(project);
rootManager.setProjectSdk(jdk);
JavaSdkVersion version = JavaSdk.getInstance().getVersion(jdk);
if (version != null) {
LanguageLevel maxLevel = version.getMaxLanguageLevel();
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(ProjectManager.getInstance().getDefaultProject());
LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(project);
if (extension.isDefault() || maxLevel.compareTo(ext.getLanguageLevel()) < 0) {
ext.setLanguageLevel(maxLevel);
}
}
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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);
}
}