use of com.android.repository.api.RepoPackage in project android by JetBrains.
the class UpgradeConstraintLayoutFix method apply.
public static void apply(@Nullable Module module) {
if (module != null) {
StudioSdkUtil.reloadRemoteSdkWithModalProgress();
AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(AndroidLintMissingConstraintsInspection.class);
RepoPackage p = SdkMavenRepository.findLatestVersion(LATEST_KNOWN_VERSION, sdkHandler, progress);
if (p != null) {
GradleCoordinate gc = SdkMavenRepository.getCoordinateFromSdkPath(p.getPath());
if (gc != null) {
// should always be the case unless the version suffix is somehow wrong
// Update version dependency in the module. Note that this will trigger a sync too.
GradleDependencyManager manager = GradleDependencyManager.getInstance(module.getProject());
manager.updateLibrariesToVersion(module, Collections.singletonList(gc), null);
}
}
}
}
use of com.android.repository.api.RepoPackage in project android by JetBrains.
the class ToolComponentsPanel method updateToolsItems.
private void updateToolsItems() {
myToolsDetailsRootNode.removeAllChildren();
myToolsSummaryRootNode.removeAllChildren();
myStates.clear();
ParentTreeNode mavenSummaryParent = new ParentTreeNode("Support Repository");
ParentTreeNode mavenDetailsParent = new ParentTreeNode("Support Repository");
for (String prefix : myMultiVersionPackages.keySet()) {
Collection<UpdatablePackage> versions = myMultiVersionPackages.get(prefix);
Set<DetailsTreeNode> detailsNodes = new TreeSet<>();
boolean isMaven = false;
for (UpdatablePackage info : versions) {
RepoPackage representative = info.getRepresentative();
if (representative.getTypeDetails() instanceof DetailsTypes.MavenType) {
isMaven = true;
}
PackageNodeModel model = new PackageNodeModel(info);
myStates.add(model);
detailsNodes.add(new DetailsTreeNode(model, myModificationListener, myConfigurable));
}
MultiVersionTreeNode summaryNode = new MultiVersionTreeNode(detailsNodes);
if (isMaven) {
mavenSummaryParent.add(summaryNode);
} else {
myToolsSummaryRootNode.add(summaryNode);
}
UpdaterTreeNode multiVersionParent = new ParentTreeNode(summaryNode.getDisplayName());
detailsNodes.forEach(multiVersionParent::add);
if (isMaven) {
mavenDetailsParent.add(multiVersionParent);
} else {
myToolsDetailsRootNode.add(multiVersionParent);
}
}
for (UpdatablePackage info : myToolsPackages) {
PackageNodeModel holder = new PackageNodeModel(info);
myStates.add(holder);
UpdaterTreeNode node = new DetailsTreeNode(holder, myModificationListener, myConfigurable);
boolean isMaven = info.getPath().endsWith(RepoPackage.PATH_SEPARATOR + MavenInstallListener.MAVEN_DIR_NAME);
if (isMaven) {
mavenDetailsParent.add(node);
} else {
myToolsDetailsRootNode.add(node);
}
if (!info.getRepresentative().obsolete()) {
UpdaterTreeNode summaryNode = new DetailsTreeNode(holder, myModificationListener, myConfigurable);
if (isMaven) {
mavenSummaryParent.add(summaryNode);
} else {
myToolsSummaryRootNode.add(summaryNode);
}
}
}
if (mavenSummaryParent.getChildCount() > 0) {
myToolsSummaryRootNode.add(mavenSummaryParent);
myToolsDetailsRootNode.add(mavenDetailsParent);
}
refreshModified();
SdkUpdaterConfigPanel.resizeColumnsToFit(myToolsDetailTable);
SdkUpdaterConfigPanel.resizeColumnsToFit(myToolsSummaryTable);
myToolsDetailTable.updateUI();
myToolsSummaryTable.updateUI();
TreeUtil.expandAll(myToolsDetailTable.getTree());
TreeUtil.expandAll(myToolsSummaryTable.getTree());
}
use of com.android.repository.api.RepoPackage in project android by JetBrains.
the class MultiVersionTreeNode method getDisplayName.
@NotNull
public String getDisplayName() {
RepoPackage maxPackage = myMaxVersionNode.getPackage();
String maxName = maxPackage.getDisplayName();
String maxPath = maxPackage.getPath();
String suffix = maxPath.substring(maxPath.lastIndexOf(RepoPackage.PATH_SEPARATOR) + 1);
maxName = StringUtil.trimEnd(maxName, suffix).trim();
maxName = StringUtil.trimEnd(maxName, ":");
return maxName;
}
Aggregations