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


Java ModifiableRootModel.getModuleExtension方法代码示例

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


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

示例1: configure

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
@Override
public void configure(
    @NotNull final ModifiableRootModel modifiableRootModel,
    @NotNull final HybrisModuleDescriptor moduleDescriptor
) {
    Validate.notNull(modifiableRootModel);
    Validate.notNull(moduleDescriptor);

    final CompilerModuleExtension compilerModuleExtension = modifiableRootModel.getModuleExtension(
        CompilerModuleExtension.class
    );

    final File outputDirectory = new File(
        moduleDescriptor.getRootDirectory(),
        HybrisConstants.JAVA_COMPILER_FAKE_OUTPUT_PATH
    );

    compilerModuleExtension.setCompilerOutputPath(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));
    compilerModuleExtension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(outputDirectory.getAbsolutePath()));

    compilerModuleExtension.setExcludeOutput(true);
    compilerModuleExtension.inheritCompilerOutputPath(false);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:24,代码来源:DefaultCompilerOutputPathsConfigurator.java

示例2: configure

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
@Override
public void configure(
    @NotNull final ModifiableRootModel modifiableRootModel,
    @NotNull final HybrisModuleDescriptor moduleDescriptor
) {
    Validate.notNull(modifiableRootModel);
    Validate.notNull(moduleDescriptor);

    final String javadocUrl = moduleDescriptor.getRootProjectDescriptor().getJavadocUrl();

    if (null != javadocUrl) {
        final JavaModuleExternalPaths javaModuleExternalPaths = modifiableRootModel.getModuleExtension(
            JavaModuleExternalPaths.class
        );

        javaModuleExternalPaths.setJavadocUrls(new String[]{javadocUrl});
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:19,代码来源:DefaultJavadocModuleConfigurator.java

示例3: createModule

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
@Override
public Module createModule(String moduleName, ModuleType moduleType) {
  Module module = moduleModel.findModuleByName(moduleName);
  if (module == null) {
    File imlFile = new File(imlDirectory, moduleName + ModuleFileType.DOT_DEFAULT_EXTENSION);
    removeImlFile(imlFile);
    module = moduleModel.newModule(imlFile.getPath(), moduleType.getId());
    module.setOption(EXTERNAL_SYSTEM_ID_KEY, EXTERNAL_SYSTEM_ID_VALUE);
  }
  module.setOption(Module.ELEMENT_TYPE, moduleType.getId());

  ModifiableRootModel modifiableModel =
      ModuleRootManager.getInstance(module).getModifiableModel();
  modules.put(module.getName(), modifiableModel);
  modifiableModel.clear();
  modifiableModel.inheritSdk();
  CompilerModuleExtension compilerSettings =
      modifiableModel.getModuleExtension(CompilerModuleExtension.class);
  if (compilerSettings != null) {
    compilerSettings.inheritCompilerOutputPath(false);
  }

  return module;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:25,代码来源:ModuleEditorImpl.java

示例4: configureModule

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的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

示例5: setOutputPaths

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
protected void setOutputPaths(@NotNull ModifiableRootModel ideaModuleModel, @NotNull File mainDirPath, @Nullable File testDirPath) {
  CompilerModuleExtension compilerSettings = ideaModuleModel.getModuleExtension(CompilerModuleExtension.class);
  if (compilerSettings == null) {
    LOG.warn(String.format("No compiler extension is found for module '%1$s'", ideaModuleModel.getModule().getName()));
    return;
  }
  compilerSettings.inheritCompilerOutputPath(false);
  compilerSettings.setCompilerOutputPath(pathToIdeaUrl(mainDirPath));
  if (testDirPath != null) {
    compilerSettings.setCompilerOutputPathForTests(pathToIdeaUrl(testDirPath));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AbstractCompileOutputModuleCustomizer.java

示例6: setupRootModel

import com.intellij.openapi.roots.ModifiableRootModel; //导入方法依赖的package包/类
private static void setupRootModel(
        ProjectDescriptor projectDescriptor,
        final ModuleDescriptor descriptor,
        final ModifiableRootModel rootModel,
        final Map<LibraryDescriptor, Library> projectLibs) {
    final CompilerModuleExtension compilerModuleExtension =
            rootModel.getModuleExtension(CompilerModuleExtension.class);
    compilerModuleExtension.setExcludeOutput(true);
    rootModel.inheritSdk();

    //Module root model seems to store .iml files root dependencies. (src, test, lib)
    logger.info("Starting setupRootModel in ProjectFromSourcesBuilderImplModified");
    final Set<File> contentRoots = descriptor.getContentRoots();
    for (File contentRoot : contentRoots) {
        final LocalFileSystem lfs = LocalFileSystem.getInstance();
        VirtualFile moduleContentRoot =
                lfs.refreshAndFindFileByPath(
                        FileUtil.toSystemIndependentName(contentRoot.getPath()));
        if (moduleContentRoot != null) {
            final ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot);
            final Collection<DetectedSourceRoot> sourceRoots =
                    descriptor.getSourceRoots(contentRoot);
            for (DetectedSourceRoot srcRoot : sourceRoots) {
                final String srcpath =
                        FileUtil.toSystemIndependentName(srcRoot.getDirectory().getPath());
                final VirtualFile sourceRoot = lfs.refreshAndFindFileByPath(srcpath);
                if (sourceRoot != null) {
                    contentEntry.addSourceFolder(
                            sourceRoot,
                            shouldBeTestRoot(srcRoot.getDirectory()),
                            getPackagePrefix(srcRoot));
                }
            }
        }
    }
    logger.info("Inherits compiler output path from project");
    compilerModuleExtension.inheritCompilerOutputPath(true);

    logger.info("Starting to create module level libraries");
    final LibraryTable moduleLibraryTable = rootModel.getModuleLibraryTable();
    for (LibraryDescriptor libDescriptor :
            ModuleInsight.getLibraryDependencies(
                    descriptor, projectDescriptor.getLibraries())) {
        final Library projectLib = projectLibs.get(libDescriptor);
        if (projectLib != null) {
            rootModel.addLibraryEntry(projectLib);
        } else {
            // add as module library
            final Collection<File> jars = libDescriptor.getJars();
            for (File file : jars) {
                Library library = moduleLibraryTable.createLibrary();
                Library.ModifiableModel modifiableModel = library.getModifiableModel();
                modifiableModel.addRoot(
                        VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
                modifiableModel.commit();
            }
        }
    }
    logger.info("Ending setupRootModel in ProjectFromSourcesBuilderImplModified");
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:61,代码来源:ProjectFromSourcesBuilderImplModified.java


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