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


Java ModuleOutputPackagingElement类代码示例

本文整理汇总了Java中com.intellij.packaging.impl.elements.ModuleOutputPackagingElement的典型用法代码示例。如果您正苦于以下问题:Java ModuleOutputPackagingElement类的具体用法?Java ModuleOutputPackagingElement怎么用?Java ModuleOutputPackagingElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModuleOutputPackagingElement类属于com.intellij.packaging.impl.elements包,在下文中一共展示了ModuleOutputPackagingElement类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeFileToArtifactsMap

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
  final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
  final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
  for (final Artifact artifact : artifactManager.getArtifacts()) {
    final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
    ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
      @Override
      public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
        if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
          final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
          if (root != null) {
            result.put(root, artifact);
          }
        }
        else if (element instanceof ModuleOutputPackagingElement) {
          for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
            result.put(sourceRoot, artifact);
          }
        }
        return true;
      }
    }, context, true);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java

示例2: computeFileToArtifactsMap

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
  final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<VirtualFile, Artifact>();
  final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
  for (final Artifact artifact : artifactManager.getArtifacts()) {
    final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
    ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
      @Override
      public boolean process(@Nonnull PackagingElement<?> element, @Nonnull PackagingElementPath path) {
        if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
          final VirtualFile root = ((FileOrDirectoryCopyPackagingElement)element).findFile();
          if (root != null) {
            result.put(root, artifact);
          }
        }
        else if (element instanceof ModuleOutputPackagingElement) {
          for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement)element).getSourceRoots(context)) {
            result.put(sourceRoot, artifact);
          }
        }
        return true;
      }
    }, context, true);
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ArtifactBySourceFileFinderImpl.java

示例3: getProjectStructureElementFor

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
@Nullable
public static ProjectStructureElement getProjectStructureElementFor(PackagingElement<?> packagingElement,
                                                                     final StructureConfigurableContext context,
                                                                     final ArtifactsStructureConfigurableContext artifactsStructureContext) {
  if (packagingElement instanceof ModuleOutputPackagingElement) {
    final Module module = ((ModuleOutputPackagingElement)packagingElement).findModule(artifactsStructureContext);
    if (module != null) {
      return new ModuleProjectStructureElement(context, module);
    }
  }
  else if (packagingElement instanceof LibraryPackagingElement) {
    final Library library = ((LibraryPackagingElement)packagingElement).findLibrary(artifactsStructureContext);
    if (library != null) {
      return new LibraryProjectStructureElement(context, library);
    }
  }
  else if (packagingElement instanceof ArtifactPackagingElement) {
    final Artifact usedArtifact = ((ArtifactPackagingElement)packagingElement).findArtifact(artifactsStructureContext);
    if (usedArtifact != null) {
      return artifactsStructureContext.getOrCreateArtifactElement(usedArtifact);
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:ArtifactProjectStructureElement.java

示例4: getProjectStructureElementFor

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
@Nullable
public static ProjectStructureElement getProjectStructureElementFor(PackagingElement<?> packagingElement,
                                                                     final StructureConfigurableContext context,
                                                                     final ArtifactsStructureConfigurableContext artifactsStructureContext) {
  if (packagingElement instanceof ModuleOutputPackagingElement) {
    final Module module = ((ModuleOutputPackagingElement)packagingElement).findModule(artifactsStructureContext);
    if (module != null) {
      return new ModuleProjectStructureElement(context, module);
    }
  }
  else if (packagingElement instanceof LibraryPackagingElement) {
    final Library library = ((LibraryPackagingElement)packagingElement).findLibrary(artifactsStructureContext);
    if (library != null) {
      return new LibraryProjectStructureElement(context, library);
    }
  }
  else if (packagingElement instanceof ArtifactPackagingElement) {
    final Artifact usedArtifact = ((ArtifactPackagingElement)packagingElement).findArtifact(artifactsStructureContext);
    if (usedArtifact != null) {
      return artifactsStructureContext.getOrCreateArtifactElement(usedArtifact);
    }
  }
  else if (packagingElement instanceof FacetBasedPackagingElement) {
    Facet facet = ((FacetBasedPackagingElement)packagingElement).findFacet(artifactsStructureContext);
    if (facet != null) {
      return new FacetProjectStructureElement(context, facet);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ArtifactProjectStructureElement.java

示例5: getNotAddedModules

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
@NotNull
private static List<? extends Module> getNotAddedModules(@NotNull final ArtifactEditorContext context, @NotNull Artifact artifact,
                                                        final Module... allModules) {
  final Set<Module> modules = new HashSet<Module>(Arrays.asList(allModules));
  ArtifactUtil.processPackagingElements(artifact, ProductionModuleOutputElementType.ELEMENT_TYPE, new Processor<ModuleOutputPackagingElement>() {
    @Override
    public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
      modules.remove(moduleOutputPackagingElement.findModule(context));
      return true;
    }
  }, context, true);
  return new ArrayList<Module>(modules);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ModulesAndLibrariesSourceItemsProvider.java

示例6: containsModuleOutput

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private static boolean containsModuleOutput(Artifact artifact, final Set<Module> modules, final PackagingElementResolvingContext context) {
  return !ArtifactUtil.processPackagingElements(artifact, ProductionModuleOutputElementType.ELEMENT_TYPE,
                                                       new Processor<ModuleOutputPackagingElement>() {
                                                         public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
                                                           final Module module = moduleOutputPackagingElement.findModule(context);
                                                           return module == null || !modules.contains(module);
                                                         }
                                                       }, context, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ArtifactCompileScope.java

示例7: containsModuleOutput

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private static boolean containsModuleOutput(Artifact artifact, final Set<Module> modules, final PackagingElementResolvingContext context) {
  return !ArtifactUtil.processPackagingElements(artifact, ProductionModuleOutputElementType.getInstance(),
                                                new Processor<ModuleOutputPackagingElement>() {
                                                  public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
                                                    final Module module = moduleOutputPackagingElement.findModule(context);
                                                    return module == null || !modules.contains(module);
                                                  }
                                                }, context, true);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:10,代码来源:ArtifactCompileScope.java

示例8: canAddModuleOutputType

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private static <T extends ModuleOutputElementTypeBase> boolean canAddModuleOutputType(@Nonnull final ArtifactEditorContext context,
                                                                                         @Nonnull Artifact artifact,
                                                                                         T type,
                                                                                         final Module module) {
  final Ref<Boolean> find = new Ref<Boolean>(true);
  ArtifactUtil
    .processPackagingElements(artifact, type, new Processor<ModuleOutputPackagingElement>() {
      @Override
      public boolean process(ModuleOutputPackagingElement moduleOutputPackagingElement) {
        if(moduleOutputPackagingElement.findModule(context) == module) {
          find.set(false);
        }
        return true;
      }
    }, context, true);

  // if it already added - we cant add new
  if(!find.get()) {
    return false;
  }

  for(ContentEntry c :  context.getModulesProvider().getRootModel(module).getContentEntries()) {
    if(c.getFolderFiles(ContentFolderScopes.of(type.getContentFolderType())).length > 0) {
      return true;
    }
  }
  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:29,代码来源:ModulesAndLibrariesSourceItemsProvider.java

示例9: createArtifactTarget

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private Target createArtifactTarget(Artifact artifact) {
  final StringBuilder depends = new StringBuilder(INIT_ARTIFACTS_TARGET);

  ArtifactUtil.processRecursivelySkippingIncludedArtifacts(artifact, new Processor<PackagingElement<?>>() {
    @Override
    public boolean process(@NotNull PackagingElement<?> packagingElement) {
      if (packagingElement instanceof ArtifactPackagingElement) {
        final Artifact included = ((ArtifactPackagingElement)packagingElement).findArtifact(myResolvingContext);
        if (included != null) {
          if (depends.length() > 0) depends.append(", ");
          depends.append(myContext.getTargetName(included));
        }
      }
      else if (packagingElement instanceof ModuleOutputPackagingElement) {
        final Module module = ((ModuleOutputPackagingElement)packagingElement).findModule(myResolvingContext);
        if (module != null) {
          if (depends.length() > 0) depends.append(", ");
          depends.append(BuildProperties.getCompileTargetName(module.getName()));
        }
      }
      return true;
    }
  }, myResolvingContext);

  final Couple<String> xmlNs = getArtifactXmlNs(artifact.getArtifactType());
  final Target artifactTarget =
      new Target(myContext.getTargetName(artifact), depends.toString(), "Build '" + artifact.getName() + "' artifact", null, 
                 xmlNs != null ? xmlNs.first : null, xmlNs != null ? xmlNs.second : null);

  if (myContext.shouldBuildIntoTempDirectory(artifact)) {
    final String outputDirectory = BuildProperties.propertyRelativePath(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY,
                                                                        FileUtil.sanitizeFileName(artifact.getName()));
    artifactTarget.add(new Property(myContext.getArtifactOutputProperty(artifact), outputDirectory));
  }

  final String outputPath = BuildProperties.propertyRef(myContext.getArtifactOutputProperty(artifact));
  artifactTarget.add(new Mkdir(outputPath));
  generateTasksForArtifacts(artifact, artifactTarget, true);

  final DirectoryAntCopyInstructionCreator creator = new DirectoryAntCopyInstructionCreator(outputPath);

  List<Generator> copyInstructions = new ArrayList<Generator>();
  if (needAntArtifactInstructions(artifact.getArtifactType())) {
    copyInstructions.addAll(artifact.getRootElement().computeAntInstructions(myResolvingContext, creator, myContext, artifact.getArtifactType()));
  }

  for (Generator generator : myContext.getAndClearBeforeCurrentArtifact()) {
    artifactTarget.add(generator);
  }
  for (Generator tag : copyInstructions) {
    artifactTarget.add(tag);
  }
  generateTasksForArtifacts(artifact, artifactTarget, false);
  return artifactTarget;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:ArtifactsGenerator.java

示例10: createArtifactTarget

import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; //导入依赖的package包/类
private Target createArtifactTarget(Artifact artifact) {
  final StringBuilder depends = new StringBuilder(INIT_ARTIFACTS_TARGET);

  ArtifactUtil.processRecursivelySkippingIncludedArtifacts(artifact, new Processor<PackagingElement<?>>() {
    @Override
    public boolean process(@NotNull PackagingElement<?> packagingElement) {
      if (packagingElement instanceof ArtifactPackagingElement) {
        final Artifact included = ((ArtifactPackagingElement)packagingElement).findArtifact(myResolvingContext);
        if (included != null) {
          if (depends.length() > 0) depends.append(", ");
          depends.append(myContext.getTargetName(included));
        }
      }
      else if (packagingElement instanceof ModuleOutputPackagingElement) {
        final Module module = ((ModuleOutputPackagingElement)packagingElement).findModule(myResolvingContext);
        if (module != null) {
          if (depends.length() > 0) depends.append(", ");
          depends.append(BuildProperties.getCompileTargetName(module.getName()));
        }
      }
      return true;
    }
  }, myResolvingContext);

  final Pair<String, String> xmlNs = getArtifactXmlNs(artifact.getArtifactType());
  final Target artifactTarget =
      new Target(myContext.getTargetName(artifact), depends.toString(), "Build '" + artifact.getName() + "' artifact", null, 
                 xmlNs != null ? xmlNs.first : null, xmlNs != null ? xmlNs.second : null);

  if (myContext.shouldBuildIntoTempDirectory(artifact)) {
    final String outputDirectory = BuildProperties.propertyRelativePath(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY,
                                                                        FileUtil.sanitizeFileName(artifact.getName()));
    artifactTarget.add(new Property(myContext.getArtifactOutputProperty(artifact), outputDirectory));
  }

  final String outputPath = BuildProperties.propertyRef(myContext.getArtifactOutputProperty(artifact));
  artifactTarget.add(new Mkdir(outputPath));
  generateTasksForArtifacts(artifact, artifactTarget, true);

  final DirectoryAntCopyInstructionCreator creator = new DirectoryAntCopyInstructionCreator(outputPath);

  List<Generator> copyInstructions = new ArrayList<Generator>();
  if (needAntArtifactInstructions(artifact.getArtifactType())) {
    copyInstructions.addAll(artifact.getRootElement().computeAntInstructions(myResolvingContext, creator, myContext, artifact.getArtifactType()));
  }

  for (Generator generator : myContext.getAndClearBeforeCurrentArtifact()) {
    artifactTarget.add(generator);
  }
  for (Generator tag : copyInstructions) {
    artifactTarget.add(tag);
  }
  generateTasksForArtifacts(artifact, artifactTarget, false);
  return artifactTarget;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:56,代码来源:ArtifactsGenerator.java


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