use of com.intellij.packaging.impl.artifacts.ParentElementProcessor in project intellij-community by JetBrains.
the class PutSourceItemIntoParentAndLinkViaManifestAction method findParentAndGrandParent.
@Nullable
private ParentElementsInfo findParentAndGrandParent(Artifact artifact) {
final Ref<ParentElementsInfo> result = Ref.create(null);
ArtifactUtil.processParents(artifact, myArtifactEditor.getContext(), new ParentElementProcessor() {
@Override
public boolean process(@NotNull CompositePackagingElement<?> element, @NotNull List<Pair<Artifact, CompositePackagingElement<?>>> parents, @NotNull Artifact artifact) {
if (parents.size() == 1) {
final Pair<Artifact, CompositePackagingElement<?>> parent = parents.get(0);
result.set(new ParentElementsInfo(parent.getFirst(), parent.getSecond(), artifact, element));
return false;
}
return true;
}
}, 1);
return result.get();
}
Aggregations