本文整理汇总了Java中com.intellij.openapi.roots.LanguageLevelProjectExtension类的典型用法代码示例。如果您正苦于以下问题:Java LanguageLevelProjectExtension类的具体用法?Java LanguageLevelProjectExtension怎么用?Java LanguageLevelProjectExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LanguageLevelProjectExtension类属于com.intellij.openapi.roots包,在下文中一共展示了LanguageLevelProjectExtension类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: setUp
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
super.setUp();
IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder( getProjectDescriptor() );
IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture( fixture, new TempDirTestFixtureImpl() );
myFixture.setUp();
myFixture.setTestDataPath( getTestDataPath() );
myModule = myFixture.getModule();
LanguageLevelProjectExtension.getInstance( getProject() ).setLanguageLevel( LanguageLevel.JDK_1_8 );
}
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:18,代码来源:SomewhatLightCodeInsightFixtureTestCase.java
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: getLanguageLevelInner
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
private LanguageLevel getLanguageLevelInner() {
if (myOriginalFile instanceof PsiJavaFile) {
return ((PsiJavaFile)myOriginalFile).getLanguageLevel();
}
LanguageLevel forcedLanguageLevel = getUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY);
if (forcedLanguageLevel != null) return forcedLanguageLevel;
VirtualFile virtualFile = getVirtualFile();
if (virtualFile == null) virtualFile = getUserData(IndexingDataKeys.VIRTUAL_FILE);
final Project project = getProject();
if (virtualFile == null) {
final PsiFile originalFile = getOriginalFile();
if (originalFile instanceof PsiJavaFile && originalFile != this) {
return ((PsiJavaFile)originalFile).getLanguageLevel();
}
return LanguageLevelProjectExtension.getInstance(project).getLanguageLevel();
}
return JavaPsiImplementationHelper.getInstance(project).getEffectiveLanguageLevel(virtualFile);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PsiJavaFileBaseImpl.java
示例8: JavaCoreProjectEnvironment
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public JavaCoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) {
super(parentDisposable, applicationEnvironment);
myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager));
myProject.registerService(JavaPsiImplementationHelper.class, createJavaPsiImplementationHelper());
myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager));
myProject.registerService(LanguageLevelProjectExtension.class, new CoreLanguageLevelProjectExtension());
myProject.registerService(JavaResolveCache.class, new JavaResolveCache(myMessageBus));
myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade());
myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager());
myPackageIndex = createCorePackageIndex();
myProject.registerService(PackageIndex.class, myPackageIndex);
myFileManager = createCoreFileManager();
myProject.registerService(JavaFileManager.class, myFileManager);
JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, myPsiManager, myFileManager, myMessageBus);
myProject.registerService(JavaPsiFacade.class, javaPsiFacade);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaCoreProjectEnvironment.java
示例9: setUp
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
@Override
public void setUp() throws Exception {
super.setUp();
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder(getName());
myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(testFixtureBuilder.getFixture());
myFixture.setTestDataPath(PathManagerEx.getTestDataPath() + "/codeInsight/externalAnnotations");
final JavaModuleFixtureBuilder builder = testFixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
new File(myFixture.getTempDirPath() + "/src/").mkdir();
builder.addContentRoot(myFixture.getTempDirPath()).addSourceRoot("src");
builder.setMockJdkLevel(JavaModuleFixtureBuilder.MockJdkLevel.jdk15);
myFixture.setUp();
myFixture.enableInspections(new SillyAssignmentInspection());
addAnnotationsModuleRoot();
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myFixture.getProject());
myLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SuppressExternalTest.java
示例10: 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
示例11: testSpaceAfterCommaInEnum
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public void testSpaceAfterCommaInEnum() throws IncorrectOperationException {
getSettings().SPACE_AFTER_COMMA = true;
final JavaPsiFacade facade = getJavaFacade();
final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
try {
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);
doTextTest("public enum StringExDirection {\n" + "\n" + " RIGHT_TO_LEFT, LEFT_TO_RIGHT\n" + "\n" + "}",
"public enum StringExDirection {\n" + "\n" + " RIGHT_TO_LEFT, LEFT_TO_RIGHT\n" + "\n" + "}");
}
finally {
LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFormatterTest.java
示例12: testSCR2632
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public void testSCR2632() throws Exception {
getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
getSettings().getRootSettings().WRAP_COMMENTS = true;
getSettings().RIGHT_MARGIN = 20;
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
doTextTest("/**\n" + " * <p />\n" + " * Another paragraph of the description placed after blank line.\n" + " */\n" + "class A{}",
"/**\n" +
" * <p/>\n" +
" * Another paragraph\n" +
" * of the description\n" +
" * placed after\n" +
" * blank line.\n" +
" */\n" +
"class A {\n" +
"}");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavadocFormatterTest.java
示例13: testSCR2632_JDK8_LanguageLevel
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public void testSCR2632_JDK8_LanguageLevel() throws Exception {
getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
getSettings().getRootSettings().WRAP_COMMENTS = true;
getSettings().RIGHT_MARGIN = 20;
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_8);
doTextTest("/**\n" + " * <p />\n" + " * Another paragraph of the description placed after blank line.\n" + " */\n" + "class A{}",
"/**\n" +
" * <p>\n" +
" * Another paragraph\n" +
" * of the description\n" +
" * placed after\n" +
" * blank line.\n" +
" */\n" +
"class A {\n" +
"}");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JavadocFormatterTest.java
示例14: testGenerateSelfClosingPTagIfLanguageLevelNotJava8
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public void testGenerateSelfClosingPTagIfLanguageLevelNotJava8() throws Exception {
getSettings().getRootSettings().JD_P_AT_EMPTY_LINES = true;
getSettings().getRootSettings().ENABLE_JAVADOC_FORMATTING = true;
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7);
String before = "/**\n" +
" * Super method\n" +
" *\n" +
" * Super multiple times\n" +
" */\n" +
"public void voo() {\n" +
"}\n";
String after = "/**\n" +
" * Super method\n" +
" * <p/>\n" +
" * Super multiple times\n" +
" */\n" +
"public void voo() {\n" +
"}\n";
doClassTest(before, after);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavadocFormatterTest.java
示例15: setProjectSdkAndLanguageLevel
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
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);
}));
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:17,代码来源:BlazeAndroidSyncPlugin.java
示例16: reset
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
public void reset(Project project) {
removeAllItems();
for (LanguageLevel level : LanguageLevel.values()) {
addItem(level);
}
Sdk sdk = ProjectRootManagerEx.getInstanceEx(project).getProjectSdk();
sdkUpdated(sdk);
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(project);
if (getDefaultLevel() != null && extension.isDefault()) {
setSelectedItem(myDefaultItem);
}
else {
setSelectedItem(extension.getLanguageLevel());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LanguageLevelCombo.java
示例17: isModified
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
@Override
@SuppressWarnings({"SimplifiableIfStatement"})
public boolean isModified() {
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(myProject);
if (!extension.getLanguageLevel().equals(myLanguageLevelCombo.getSelectedLevel()) ||
extension.isDefault() != myLanguageLevelCombo.isDefault()) {
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 (myProjectName != null) {
if (!myProjectName.getText().trim().equals(myProject.getName())) return true;
}
return false;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ProjectConfigurable.java
示例18: syncJavaLangLevel
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
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);
}
}
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PostProjectBuildTasksExecutor.java
示例19: testLanguageLevelForApi21
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
@Test @IdeGuiTest
public void testLanguageLevelForApi21() {
// Verifies that creating a project with L will set the language level correctly
// both in the generated Gradle model as well as in the synced project and modules
// "20+" here should change to 21 as soon as L goes out of preview state
IdeFrameFixture projectFrame = newProject("Test Application").withBriefNames().withMinSdk("20+").create();
IdeaAndroidProject appAndroidProject = projectFrame.getAndroidProjectForModule("app");
AndroidProject model = appAndroidProject.getDelegate();
ApiVersion minSdkVersion = model.getDefaultConfig().getProductFlavor().getMinSdkVersion();
assertNotNull("minSdkVersion", minSdkVersion);
// If this test fails, verify that
// (1) you have the L preview installed in the SDK on the test machine
// (2) the associated JDK is JDK 7 or higher
assertThat(minSdkVersion.getApiString()).as("minSdkVersion API").isEqualTo("L");
assertThat(appAndroidProject.getJavaLanguageLevel()).as("Gradle Java language level").isSameAs(LanguageLevel.JDK_1_7);
LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(projectFrame.getProject());
assertThat(projectExt.getLanguageLevel()).as("Project Java language level").isSameAs(LanguageLevel.JDK_1_7);
for (Module module : ModuleManager.getInstance(projectFrame.getProject()).getModules()) {
LanguageLevelModuleExtension moduleExt = LanguageLevelModuleExtensionImpl.getInstance(module);
assertThat(moduleExt.getLanguageLevel()).as("Gradle Java language level in module " + module.getName()).isNull();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:NewProjectTest.java
示例20: tearDown
import com.intellij.openapi.roots.LanguageLevelProjectExtension; //导入依赖的package包/类
@AfterMethod
public void tearDown() throws Exception {
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
try {
LanguageLevelProjectExtension.getInstance(myFixture.getProject()).setLanguageLevel(myLanguageLevel);
myFixture.tearDown();
myFixture = null;
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AddTestNGJarFixTest.java
注:本文中的com.intellij.openapi.roots.LanguageLevelProjectExtension类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论