本文整理汇总了Java中com.intellij.openapi.roots.LanguageLevelModuleExtension类的典型用法代码示例。如果您正苦于以下问题:Java LanguageLevelModuleExtension类的具体用法?Java LanguageLevelModuleExtension怎么用?Java LanguageLevelModuleExtension使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LanguageLevelModuleExtension类属于com.intellij.openapi.roots包,在下文中一共展示了LanguageLevelModuleExtension类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getJava8Modules
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@NotNull
private static Set<Module> getJava8Modules(Project project) {
final boolean projectLevelIsHigh = PsiUtil.getLanguageLevel(project).isAtLeast(LanguageLevel.JDK_1_8);
final Set<Module> highLevelModules = new HashSet<Module>();
for (Module module : ModuleManager.getInstance(project).getModules()) {
final LanguageLevelModuleExtension extension = ModuleRootManager.getInstance(module).getModuleExtension(LanguageLevelModuleExtension.class);
if (extension != null) {
final LanguageLevel level = extension.getLanguageLevel();
if (level == null && projectLevelIsHigh || level != null && level.isAtLeast(LanguageLevel.JDK_1_8)) {
highLevelModules.add(module);
}
}
}
return highLevelModules;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaFunctionalExpressionSearcher.java
示例2: testLanguageLevelForApi21
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的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
示例3: configureModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
LanguageLevelModuleExtension extension = model.getModuleExtension(LanguageLevelModuleExtension.class);
if (extension != null) {
extension.setLanguageLevel(LanguageLevel.HIGHEST);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DefaultLightProjectDescriptor.java
示例4: getEffectiveLanguageLevel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@NotNull
public static LanguageLevel getEffectiveLanguageLevel(@NotNull final Module module) {
ApplicationManager.getApplication().assertReadAccessAllowed();
LanguageLevelModuleExtension moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module);
LanguageLevel level = moduleLevel == null ? null : moduleLevel.getLanguageLevel();
if (level != null) return level;
return LanguageLevelProjectExtension.getInstance(module.getProject()).getLanguageLevel();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:EffectiveLanguageLevelUtil.java
示例5: testCreateNewMobileProject
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Test @IdeGuiTest
public void testCreateNewMobileProject() {
IdeFrameFixture projectFrame = newProject("Test Application").create();
FileFixture layoutFile = projectFrame.findExistingFileByRelativePath("app/src/main/res/layout/activity_main.xml");
layoutFile.requireOpenAndSelected();
// Verify state of project
projectFrame.requireModuleCount(2);
IdeaAndroidProject appAndroidProject = projectFrame.getAndroidProjectForModule("app");
assertThat(appAndroidProject.getVariantNames()).as("variants").containsOnly("debug", "release");
assertThat(appAndroidProject.getSelectedVariant().getName()).as("selected variant").isEqualTo("debug");
AndroidProject model = appAndroidProject.getDelegate();
ApiVersion minSdkVersion = model.getDefaultConfig().getProductFlavor().getMinSdkVersion();
assertNotNull("minSdkVersion", minSdkVersion);
assertThat(minSdkVersion.getApiString()).as("minSdkVersion API").isEqualTo("19");
// Make sure that the activity registration uses the relative syntax
// (regression test for https://code.google.com/p/android/issues/detail?id=76716)
EditorFixture editor = projectFrame.getEditor();
editor.open("app/src/main/AndroidManifest.xml");
int offset = editor.findOffset("\".^MainActivity\"");
assertTrue(offset != -1);
// Creating a project with minSdkVersion 19 should leave the Java language level as Java 6
// For L and higher we use Java 7 language level; that is tested separately in testLanguageLevelForApi21
assertThat(appAndroidProject.getJavaLanguageLevel()).as("Gradle Java language level").isSameAs(LanguageLevel.JDK_1_6);
LanguageLevelProjectExtension projectExt = LanguageLevelProjectExtension.getInstance(projectFrame.getProject());
assertThat(projectExt.getLanguageLevel()).as("Project Java language level").isSameAs(LanguageLevel.JDK_1_6);
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,代码行数:35,代码来源:NewProjectTest.java
示例6: setModuleLanguageLevel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
private static void setModuleLanguageLevel(Module module, LanguageLevel languageLevel) {
final ModifiableRootModel rootModel =
ModuleRootManager.getInstance(module).getModifiableModel();
rootModel
.getModuleExtension(LanguageLevelModuleExtension.class)
.setLanguageLevel(languageLevel);
ApplicationManager.getApplication().runWriteAction(() -> rootModel.commit());
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-intellij,代码行数:10,代码来源:AppEngineStandardUnsupportedJavaVersionCheck.java
示例7: configureModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
LanguageLevelModuleExtension extension = model.getModuleExtension(LanguageLevelModuleExtension.class);
if (extension != null) {
extension.setLanguageLevel(LanguageLevel.HIGHEST);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:DefaultLightProjectDescriptor.java
示例8: withLevel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的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 = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
try {
projectExt.setLanguageLevel(level);
setModuleLanguageLevel(module, level);
r.run();
}
finally {
setModuleLanguageLevel(module, moduleLevel);
projectExt.setLanguageLevel(projectLevel);
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:IdeaTestUtil.java
示例9: addAdditionalSettingsToPanel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
protected void addAdditionalSettingsToPanel(final JPanel mainPanel) {
myLanguageLevelConfigurable = new LanguageLevelConfigurable() {
@Override
public LanguageLevelModuleExtension getLanguageLevelExtension() {
return getModel().getModuleExtension(LanguageLevelModuleExtension.class);
}
};
mainPanel.add(myLanguageLevelConfigurable.createComponent(), BorderLayout.NORTH);
myLanguageLevelConfigurable.reset();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ContentEntriesEditor.java
示例10: getEffectiveLanguageLevel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@NotNull
public static LanguageLevel getEffectiveLanguageLevel(@NotNull final Module module) {
ApplicationManager.getApplication().assertReadAccessAllowed();
LanguageLevelModuleExtension moduleLevel = LanguageLevelModuleExtension.getInstance(module);
LanguageLevel level = moduleLevel == null ? null : moduleLevel.getLanguageLevel();
if (level != null) return level;
return LanguageLevelProjectExtension.getInstance(module.getProject()).getLanguageLevel();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:EffectiveLanguageLevelUtil.java
示例11: getProjectDescriptor
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return new DefaultLightProjectDescriptor() {
@Override
public Sdk getSdk() {
return JavaSdk.getInstance().createJdk("java 1.7", "lib/mockJDK-1.7", false);
}
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_7);
}
};
}
开发者ID:mplushnikov,项目名称:lombok-intellij-plugin,代码行数:16,代码来源:AbstractLombokLightCodeInsightTestCase.java
示例12: configureModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
public void configureModule( @NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry )
{
model.getModuleExtension( LanguageLevelModuleExtension.class ).setLanguageLevel( LanguageLevel.JDK_1_4 );
}
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:6,代码来源:SomewhatLightCodeInsightFixtureTestCase.java
示例13: configureModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
public void configureModule(@NotNull Module module, @NotNull ModifiableRootModel model, @NotNull ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_4);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:LightCodeInsightFixtureTestCase.java
示例14: configureModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
model.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(LanguageLevel.JDK_1_6);
}
开发者ID:eddysystems,项目名称:eddy,代码行数:5,代码来源:Tests.java
示例15: setModuleLanguageLevel
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
public static void setModuleLanguageLevel(Module module, final LanguageLevel level) {
final LanguageLevelModuleExtension modifiable = (LanguageLevelModuleExtension)LanguageLevelModuleExtension.getInstance(module).getModifiableModel(true);
modifiable.setLanguageLevel(level);
modifiable.commit();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:6,代码来源:IdeaTestUtil.java
示例16: getLanguageLevelForModule
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
private LanguageLevel getLanguageLevelForModule() {
return LanguageLevelModuleExtension.getInstance(getModule("project")).getLanguageLevel();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:StructureImportingTest.java
示例17: patchJavaParameters
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
public void patchJavaParameters(Executor executor, RunProfile configuration, JavaParameters javaParameters) {
if (!executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
return;
}
if (!GroovyDebuggerSettings.getInstance().ENABLE_GROOVY_HOTSWAP) {
return;
}
if (hasSpringLoadedReloader(javaParameters)) {
return;
}
if (!(configuration instanceof RunConfiguration)) {
return;
}
final Project project = ((RunConfiguration)configuration).getProject();
if (project == null) {
return;
}
if (!LanguageLevelProjectExtension.getInstance(project).getLanguageLevel().isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
if (configuration instanceof ModuleBasedConfiguration) {
final Module module = ((ModuleBasedConfiguration)configuration).getConfigurationModule().getModule();
if (module != null) {
final LanguageLevel level = LanguageLevelModuleExtension.getInstance(module).getLanguageLevel();
if (level != null && !level.isAtLeast(LanguageLevel.JDK_1_5)) {
return;
}
}
}
Sdk jdk = javaParameters.getJdk();
if (jdk != null) {
String vendor = JdkUtil.getJdkMainAttribute(jdk, Attributes.Name.IMPLEMENTATION_VENDOR);
if (vendor != null && vendor.contains("IBM")) {
LOG.info("Due to IBM JDK pecularities (IDEA-59070) we don't add groovy agent when running applications under it");
return;
}
}
if (!project.isDefault() && containsGroovyClasses(project)) {
final String agentPath = handleSpacesInPath(getAgentJarPath());
if (agentPath != null) {
javaParameters.getVMParametersList().add("-javaagent:" + agentPath);
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:GroovyHotSwapper.java
示例18: getLanguageLevelExtension
import com.intellij.openapi.roots.LanguageLevelModuleExtension; //导入依赖的package包/类
public abstract LanguageLevelModuleExtension getLanguageLevelExtension();
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:2,代码来源:LanguageLevelConfigurable.java
注:本文中的com.intellij.openapi.roots.LanguageLevelModuleExtension类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论