use of com.android.tools.idea.gradle.structure.configurables.android.dependencies.treeview.LibraryDependencyNode in project android by JetBrains.
the class DependenciesTreeRootNode method createChildren.
@Override
@NotNull
protected List<? extends AbstractPsModelNode> createChildren() {
T model = getFirstModel();
DependencyCollector collector = myDependencyCollectorFunction.apply(model);
List<AbstractDependencyNode> children = Lists.newArrayList();
for (Map.Entry<LibraryDependencySpecs, List<PsLibraryAndroidDependency>> entry : collector.libraryDependenciesBySpec.entrySet()) {
LibraryDependencyNode child = new LibraryDependencyNode(this, entry.getValue());
children.add(child);
}
for (Map.Entry<String, List<PsModuleAndroidDependency>> entry : collector.moduleDependenciesByGradlePath.entrySet()) {
ModuleDependencyNode child = new ModuleDependencyNode(this, entry.getValue());
children.add(child);
}
Collections.sort(children, DependencyNodeComparator.INSTANCE);
return children;
}
use of com.android.tools.idea.gradle.structure.configurables.android.dependencies.treeview.LibraryDependencyNode in project android by JetBrains.
the class DependenciesTreeBuilder method find.
@Nullable
public LibraryDependencyNode find(@NotNull PsArtifactDependencySpec spec) {
DefaultMutableTreeNode rootNode = getRootNode();
if (rootNode == null) {
return null;
}
int childCount = rootNode.getChildCount();
for (int i = 0; i < childCount; i++) {
TreeNode child = rootNode.getChildAt(i);
if (!(child instanceof DefaultMutableTreeNode)) {
continue;
}
Object userObject = ((DefaultMutableTreeNode) child).getUserObject();
if (!(userObject instanceof LibraryDependencyNode)) {
continue;
}
LibraryDependencyNode node = (LibraryDependencyNode) userObject;
for (PsLibraryAndroidDependency dependency : node.getModels()) {
if (spec.equals(dependency.getDeclaredSpec())) {
return node;
}
}
}
return null;
}
Aggregations