當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。