本文整理汇总了Java中com.intellij.packaging.impl.artifacts.ArtifactUtil.processPackagingElements方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactUtil.processPackagingElements方法的具体用法?Java ArtifactUtil.processPackagingElements怎么用?Java ArtifactUtil.processPackagingElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.packaging.impl.artifacts.ArtifactUtil
的用法示例。
在下文中一共展示了ArtifactUtil.processPackagingElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUsagesInElement
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@Override
public List<ProjectStructureElementUsage> getUsagesInElement() {
final Artifact artifact = myArtifactsStructureContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
final List<ProjectStructureElementUsage> usages = new ArrayList<ProjectStructureElementUsage>();
final CompositePackagingElement<?> rootElement = myArtifactsStructureContext.getRootElement(artifact);
ArtifactUtil.processPackagingElements(rootElement, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> packagingElement, @NotNull PackagingElementPath path) {
ProjectStructureElement element = getProjectStructureElementFor(packagingElement, ArtifactProjectStructureElement.this.myContext,
ArtifactProjectStructureElement.this.myArtifactsStructureContext);
if (element != null) {
usages.add(createUsage(packagingElement, element, path.getPathStringFrom("/", rootElement)));
}
return true;
}
}, myArtifactsStructureContext, false, artifact.getArtifactType());
return usages;
}
示例2: getNotAddedLibraries
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
private static List<? extends Library> getNotAddedLibraries(@NotNull final ArtifactEditorContext context, @NotNull Artifact artifact,
List<Library> librariesList) {
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
ArtifactUtil.processPackagingElements(artifact, PackagingElementFactoryImpl.FILE_COPY_ELEMENT_TYPE, new Processor<FileCopyPackagingElement>() {
@Override
public boolean process(FileCopyPackagingElement fileCopyPackagingElement) {
final VirtualFile root = fileCopyPackagingElement.getLibraryRoot();
if (root != null) {
roots.add(root);
}
return true;
}
}, context, true);
final List<Library> result = new ArrayList<Library>();
for (Library library : librariesList) {
if (!roots.containsAll(Arrays.asList(library.getFiles(OrderRootType.CLASSES)))) {
result.add(library);
}
}
return result;
}
示例3: getSourceItems
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Collection<? extends PackagingSourceItem> getSourceItems(@NotNull ArtifactEditorContext editorContext, @NotNull Artifact artifact,
@Nullable PackagingSourceItem parent) {
if (parent instanceof ModuleSourceItemGroup) {
final Module module = ((ModuleSourceItemGroup)parent).getModule();
final Set<F> facets = new HashSet<F>(editorContext.getFacetsProvider().getFacetsByType(module, myFacetTypeId));
ArtifactUtil.processPackagingElements(artifact, myElementType, new Processor<E>() {
@Override
public boolean process(E e) {
F facet = getFacet(e);
if (facet != null) {
facets.remove(facet);
}
return true;
}
}, editorContext, true);
if (!facets.isEmpty()) {
return Collections.singletonList(new FacetBasedSourceItem<F>(this, facets.iterator().next()));
}
}
return Collections.emptyList();
}
示例4: collectIncludedArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的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);
}
示例5: collectIncludedArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的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);
}
示例6: getUsagesInElement
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@Override
public List<ProjectStructureElementUsage> getUsagesInElement() {
final Artifact artifact = myArtifactsStructureContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
final List<ProjectStructureElementUsage> usages = new ArrayList<ProjectStructureElementUsage>();
final CompositePackagingElement<?> rootElement = myArtifactsStructureContext.getRootElement(artifact);
ArtifactUtil.processPackagingElements(rootElement, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@Nonnull PackagingElement<?> packagingElement, @Nonnull PackagingElementPath path) {
ProjectStructureElement element = getProjectStructureElementFor(packagingElement, ArtifactProjectStructureElement.this.myContext,
ArtifactProjectStructureElement.this.myArtifactsStructureContext);
if (element != null) {
usages.add(createUsage(packagingElement, element, path.getPathStringFrom("/", rootElement)));
}
return true;
}
}, myArtifactsStructureContext, false, artifact.getArtifactType());
return usages;
}
示例7: getNotAddedLibraries
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
private static List<? extends Library> getNotAddedLibraries(@Nonnull final ArtifactEditorContext context,
@Nonnull Artifact artifact,
List<Library> librariesList) {
final Set<VirtualFile> roots = new HashSet<VirtualFile>();
ArtifactUtil
.processPackagingElements(artifact, FileCopyElementType.getInstance(), new Processor<FileCopyPackagingElement>() {
@Override
public boolean process(FileCopyPackagingElement fileCopyPackagingElement) {
final VirtualFile root = fileCopyPackagingElement.getLibraryRoot();
if (root != null) {
roots.add(root);
}
return true;
}
}, context, true);
final List<Library> result = new ArrayList<Library>();
for (Library library : librariesList) {
if (!roots.containsAll(Arrays.asList(library.getFiles(BinariesOrderRootType.getInstance())))) {
result.add(library);
}
}
return result;
}
示例8: getNotAddedModules
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的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);
}
示例9: getAvailableArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@NotNull
public static List<? extends Artifact> getAvailableArtifacts(@NotNull final ArtifactEditorContext context,
@NotNull final Artifact artifact,
final boolean notIncludedOnly) {
final Set<Artifact> result = new HashSet<Artifact>(Arrays.asList(context.getArtifactModel().getArtifacts()));
if (notIncludedOnly) {
ArtifactUtil.processPackagingElements(artifact, ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
public boolean process(ArtifactPackagingElement artifactPackagingElement) {
result.remove(artifactPackagingElement.findArtifact(context));
return true;
}
}, context, true);
}
result.remove(artifact);
final Iterator<Artifact> iterator = result.iterator();
while (iterator.hasNext()) {
Artifact another = iterator.next();
final boolean notContainThis =
ArtifactUtil.processPackagingElements(another, ARTIFACT_ELEMENT_TYPE, new Processor<ArtifactPackagingElement>() {
public boolean process(ArtifactPackagingElement element) {
return !artifact.getName().equals(element.getArtifactName());
}
}, context, true);
if (!notContainThis) {
iterator.remove();
}
}
final ArrayList<Artifact> list = new ArrayList<Artifact>(result);
Collections.sort(list, ArtifactManager.ARTIFACT_COMPARATOR);
return list;
}
示例10: containsModuleOutput
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的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);
}
示例11: applyChanges
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@Override
public void applyChanges(ModifiableArtifactModel artifactModel, final PackagingElementResolvingContext context) {
myManifestFiles.saveManifestFiles();
final List<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>> elementsToInclude =
new ArrayList<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>>();
for (Artifact artifact : artifactModel.getArtifacts()) {
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE,
new PackagingElementProcessor<ArtifactPackagingElement>() {
@Override
public boolean process(@NotNull ArtifactPackagingElement artifactPackagingElement,
@NotNull PackagingElementPath path) {
final Artifact included = artifactPackagingElement.findArtifact(context);
final CompositePackagingElement<?> parent = path.getLastParent();
if (parent != null && included != null) {
final List<PackagingElement<?>> elements = myExternalDependencies.get(included);
if (elements != null) {
elementsToInclude.add(Pair.create(parent, elements));
}
}
return true;
}
}, context, false);
}
for (Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>> pair : elementsToInclude) {
pair.getFirst().addOrFindChildren(pair.getSecond());
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ArtifactExternalDependenciesImporterImpl.java
示例12: containsAndroidPackage
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
public static boolean containsAndroidPackage(ArtifactEditorContext editorContext, Artifact artifact) {
return !ArtifactUtil
.processPackagingElements(artifact, AndroidFinalPackageElementType.getInstance(), new Processor<AndroidFinalPackageElement>() {
@Override
public boolean process(AndroidFinalPackageElement e) {
return false;
}
}, editorContext, true);
}
示例13: getPackagedFacet
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@Nullable
public static AndroidFacet getPackagedFacet(Project project, Artifact artifact) {
final Ref<AndroidFinalPackageElement> elementRef = Ref.create(null);
final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(project).getResolvingContext();
ArtifactUtil
.processPackagingElements(artifact, AndroidFinalPackageElementType.getInstance(), new Processor<AndroidFinalPackageElement>() {
@Override
public boolean process(AndroidFinalPackageElement e) {
elementRef.set(e);
return false;
}
}, resolvingContext, true);
final AndroidFinalPackageElement element = elementRef.get();
return element != null ? element.getFacet() : null;
}
示例14: applyChanges
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
public void applyChanges(ModifiableArtifactModel artifactModel, final PackagingElementResolvingContext context) {
myManifestFiles.saveManifestFiles();
final List<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>> elementsToInclude =
new ArrayList<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>>();
for (Artifact artifact : artifactModel.getArtifacts()) {
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE,
new PackagingElementProcessor<ArtifactPackagingElement>() {
@Override
public boolean process(@NotNull ArtifactPackagingElement artifactPackagingElement,
@NotNull PackagingElementPath path) {
final Artifact included = artifactPackagingElement.findArtifact(context);
final CompositePackagingElement<?> parent = path.getLastParent();
if (parent != null && included != null) {
final List<PackagingElement<?>> elements = myExternalDependencies.get(included);
if (elements != null) {
elementsToInclude.add(Pair.create(parent, elements));
}
}
return true;
}
}, context, false);
}
for (Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>> pair : elementsToInclude) {
pair.getFirst().addOrFindChildren(pair.getSecond());
}
}
示例15: getAvailableArtifacts
import com.intellij.packaging.impl.artifacts.ArtifactUtil; //导入方法依赖的package包/类
@Nonnull
public static List<? extends Artifact> getAvailableArtifacts(@Nonnull final ArtifactEditorContext context,
@Nonnull final Artifact artifact,
final boolean notIncludedOnly) {
final Set<Artifact> result = new HashSet<Artifact>(Arrays.asList(context.getArtifactModel().getArtifacts()));
if (notIncludedOnly) {
ArtifactUtil.processPackagingElements(artifact, getInstance(), new Processor<ArtifactPackagingElement>() {
@Override
public boolean process(ArtifactPackagingElement artifactPackagingElement) {
result.remove(artifactPackagingElement.findArtifact(context));
return true;
}
}, context, true);
}
result.remove(artifact);
final Iterator<Artifact> iterator = result.iterator();
while (iterator.hasNext()) {
Artifact another = iterator.next();
final boolean notContainThis =
ArtifactUtil.processPackagingElements(another, getInstance(), new Processor<ArtifactPackagingElement>() {
@Override
public boolean process(ArtifactPackagingElement element) {
return !artifact.getName().equals(element.getArtifactName());
}
}, context, true);
if (!notContainThis) {
iterator.remove();
}
}
final ArrayList<Artifact> list = new ArrayList<Artifact>(result);
Collections.sort(list, ArtifactManager.ARTIFACT_COMPARATOR);
return list;
}