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


Java PackagingElementResolvingContext类代码示例

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


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

示例1: getManifestFile

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Nullable 
public ManifestFileConfiguration getManifestFile(CompositePackagingElement<?> element, ArtifactType artifactType,
                                                 final PackagingElementResolvingContext context) {
  final VirtualFile manifestFile = ManifestFileUtil.findManifestFile(element, context, artifactType);
  if (manifestFile == null) {
    return null;
  }

  ManifestFileConfiguration configuration = myManifestFiles.get(manifestFile);
  if (configuration == null) {
    configuration = ManifestFileUtil.createManifestFileConfiguration(manifestFile);
    myOriginalManifestFiles.put(manifestFile, new ManifestFileConfiguration(configuration));
    myManifestFiles.put(manifestFile, configuration);
  }
  return configuration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ManifestFilesInfo.java

示例2: computeAntInstructions

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Override
public List<? extends Generator> computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext,
                                                        @NotNull AntCopyInstructionCreator creator,
                                                        @NotNull ArtifactAntGenerationContext generationContext,
                                                        @NotNull ArtifactType artifactType) {
  final String jarPath = generationContext.getSubstitutedPath(myFilePath);
  final String pathInJar = StringUtil.trimStart(myPathInJar, "/");
  if (pathInJar.length() == 0) {
    return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath));
  }

  final String archiveName = PathUtil.getFileName(myFilePath);
  final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName);
  final String tempDirPath = BuildProperties.propertyRef(tempDirProperty);
  generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath));

  final Unzip unzip = new Unzip(jarPath, tempDirPath);
  final PatternSet patterns = new PatternSet(null);
  patterns.add(new Include(pathInJar + "**"));
  unzip.add(patterns);
  generationContext.runBeforeCurrentArtifact(unzip);

  return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExtractedDirectoryPackagingElement.java

示例3: computeAntInstructions

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Override
public List<? extends Generator> computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator,
                                                        @NotNull ArtifactAntGenerationContext generationContext,
                                                        @NotNull ArtifactType artifactType) {
  final String tempJarProperty = generationContext.createNewTempFileProperty("temp.jar.path." + myArchiveFileName, myArchiveFileName);
  String jarPath = BuildProperties.propertyRef(tempJarProperty);
  final Tag jar;
  if (myArchiveFileName.endsWith(".jar")) {
    jar = new Jar(jarPath, "preserve", true);
  }
  else {
    jar = new Zip(jarPath);
  }
  for (Generator generator : computeChildrenGenerators(resolvingContext, new ArchiveAntCopyInstructionCreator(""), generationContext, artifactType)) {
    jar.add(generator);
  }
  generationContext.runBeforeCurrentArtifact(jar);
  return Collections.singletonList(creator.createFileCopyInstruction(jarPath, myArchiveFileName));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ArchivePackagingElement.java

示例4: findLibrary

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Nullable
public Library findLibrary(@NotNull PackagingElementResolvingContext context) {
  if (myModuleName == null) {
    return context.findLibrary(myLevel, myLibraryName);
  }
  final ModulesProvider modulesProvider = context.getModulesProvider();
  final Module module = modulesProvider.getModule(myModuleName);
  if (module != null) {
    for (OrderEntry entry : modulesProvider.getRootModel(module).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
        if (libraryEntry.isModuleLevel()) {
          final String libraryName = libraryEntry.getLibraryName();
          if (libraryName != null && libraryName.equals(myLibraryName)) {
            return libraryEntry.getLibrary();
          }
        }
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:LibraryPackagingElement.java

示例5: computeFileToArtifactsMap

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的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

示例6: setupModulesCombobox

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
private void setupModulesCombobox(PackagingElementResolvingContext context) {
  final Module[] modules = context.getModulesProvider().getModules().clone();
  Arrays.sort(modules, ModulesAlphaComparator.INSTANCE);
  if (modules.length > 1) {
    myModuleComboBox.addItem(null);
  }
  for (Module module : modules) {
    myModuleComboBox.addItem(module);
  }
  myModuleComboBox.setRenderer(new ModuleListRenderer(myModuleComboBox));
  new ComboboxSpeedSearch(myModuleComboBox) {
    @Override
    protected String getElementText(Object element) {
      return element instanceof Module ? ((Module)element).getName() : "";
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:JarArtifactFromModulesDialog.java

示例7: collectIncludedArtifacts

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
private static void collectIncludedArtifacts(Artifact artifact, final PackagingElementResolvingContext context,
                                             final Set<Artifact> processed, final Set<Artifact> result, final boolean withOutputPathOnly) {
  if (!processed.add(artifact)) {
    return;
  }
  if (!withOutputPathOnly || !StringUtil.isEmpty(artifact.getOutputPath())) {
    result.add(artifact);
  }

  ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
      @Override
      public boolean process(ArtifactPackagingElement element) {
        Artifact included = element.findArtifact(context);
        if (included != null) {
          collectIncludedArtifacts(included, context, processed, result, withOutputPathOnly);
        }
        return true;
      }
    }, context, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ArtifactCompileScope.java

示例8: getNewArtifactTemplates

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@NotNull
@Override
public List<? extends ArtifactTemplate> getNewArtifactTemplates(@NotNull PackagingElementResolvingContext context) {
  final List<AndroidFacet> facets = new ArrayList<AndroidFacet>();

  for (Module module : context.getModulesProvider().getModules()) {
    final FacetModel facetModel = context.getModulesProvider().getFacetModel(module);
    final AndroidFacet facet = facetModel.getFacetByType(AndroidFacet.ID);

    if (facet != null && !facet.isLibraryProject()) {
      facets.add(facet);
    }
  }

  if (facets.size() == 0) {
    return Collections.emptyList();
  }
  return Collections.singletonList(new MyTemplate(context.getProject(), facets));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidApplicationArtifactType.java

示例9: getSourceRoots

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@NotNull
@Override
public Collection<VirtualFile> getSourceRoots(PackagingElementResolvingContext context) {
  Module module = findModule(context);
  if (module == null) return Collections.emptyList();

  List<VirtualFile> roots = new SmartList<VirtualFile>();
  ModuleRootModel rootModel = context.getModulesProvider().getRootModel(module);
  for (ContentEntry entry : rootModel.getContentEntries()) {
    for (SourceFolder folder : entry.getSourceFolders()) {
      if (folder.isTestSource()) {
        ContainerUtil.addIfNotNull(folder.getFile(), roots);
      }
    }
  }
  return roots;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:TestModuleOutputPackagingElement.java

示例10: getIn

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Override
public Iterator<String> getIn(String name) {
  final Set<String> included = new LinkedHashSet<String>();
  final PackagingElementResolvingContext context = myArtifactManager.getResolvingContext();
  final Artifact artifact = context.getArtifactModel().findArtifact(name);
  if (artifact != null) {
    ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE, new PackagingElementProcessor<ArtifactPackagingElement>() {
      @Override
      public boolean process(@NotNull ArtifactPackagingElement element,
                             @NotNull PackagingElementPath path) {
        final String artifactName = element.getArtifactName();
        if (myArtifactNames.contains(artifactName)) {
          included.add(artifactName);
        }
        return true;
      }
    }, context, false);
  }
  return included.iterator();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ArtifactSortingUtilImpl.java

示例11: computeIncrementalCompilerInstructions

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Override
public void computeIncrementalCompilerInstructions(@NotNull IncrementalCompilerInstructionCreator creator,
		@NotNull PackagingElementResolvingContext resolvingContext,
		@NotNull ArtifactIncrementalCompilerContext compilerContext,
		@NotNull ArtifactType artifactType)
{
	Module module = findModule(resolvingContext);
	if(module != null)
	{
		VirtualFile[] virtualFiles = ModuleRootManager.getInstance(module).getContentFolderFiles(ContentFolderScopes.of(myContentFolderType));

		for(VirtualFile virtualFile : virtualFiles)
		{
			creator.addDirectoryCopyInstructions(virtualFile, null);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:WebResourceModuleOutputPackagingElement.java

示例12: findLibrary

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Nullable
public Library findLibrary(@Nonnull PackagingElementResolvingContext context) {
  if (myModuleName == null) {
    return context.findLibrary(myLevel, myLibraryName);
  }
  final ModulesProvider modulesProvider = context.getModulesProvider();
  final Module module = modulesProvider.getModule(myModuleName);
  if (module != null) {
    for (OrderEntry entry : modulesProvider.getRootModel(module).getOrderEntries()) {
      if (entry instanceof LibraryOrderEntry) {
        final LibraryOrderEntry libraryEntry = (LibraryOrderEntry)entry;
        if (libraryEntry.isModuleLevel()) {
          final String libraryName = libraryEntry.getLibraryName();
          if (libraryName != null && libraryName.equals(myLibraryName)) {
            return libraryEntry.getLibrary();
          }
        }
      }
    }
  }
  return null;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:23,代码来源:LibraryPackagingElement.java

示例13: computeFileToArtifactsMap

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的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

示例14: getIn

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
@Override
public Iterator<String> getIn(String name) {
  final Set<String> included = new LinkedHashSet<String>();
  final PackagingElementResolvingContext context = myArtifactManager.getResolvingContext();
  final Artifact artifact = context.getArtifactModel().findArtifact(name);
  if (artifact != null) {
    ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.getInstance(), new PackagingElementProcessor<ArtifactPackagingElement>() {
      @Override
      public boolean process(@Nonnull ArtifactPackagingElement element,
                             @Nonnull PackagingElementPath path) {
        final String artifactName = element.getArtifactName();
        if (myArtifactNames.contains(artifactName)) {
          included.add(artifactName);
        }
        return true;
      }
    }, context, false);
  }
  return included.iterator();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ArtifactSortingUtilImpl.java

示例15: collectIncludedArtifacts

import com.intellij.packaging.elements.PackagingElementResolvingContext; //导入依赖的package包/类
private static void collectIncludedArtifacts(Artifact artifact, final PackagingElementResolvingContext context,
                                             final Set<Artifact> processed, final Set<Artifact> result, final boolean withOutputPathOnly) {
  if (!processed.add(artifact)) {
    return;
  }
  if (!withOutputPathOnly || !StringUtil.isEmpty(artifact.getOutputPath())) {
    result.add(artifact);
  }

  ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.getInstance(), new Processor<ArtifactPackagingElement>() {
    @Override
    public boolean process(ArtifactPackagingElement element) {
      Artifact included = element.findArtifact(context);
      if (included != null) {
        collectIncludedArtifacts(included, context, processed, result, withOutputPathOnly);
      }
      return true;
    }
  }, context, false);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ArtifactCompileScope.java


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