use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class HaxmWizard method doCancelAction.
@Override
public void doCancelAction() {
if (myHaxmPath.canPerformFinishingActions()) {
doFinishAction();
return;
}
// Have to ensure the SDK package is removed
if (!myInvokedToUninstall) {
try {
AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
ComponentInstaller componentInstaller = new ComponentInstaller(sdkHandler);
ProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
sdkHandler.getSdkManager(progress).reloadLocalIfNeeded(progress);
componentInstaller.ensureSdkPackagesUninstalled(myHaxmPath.myHaxm.getRequiredSdkPackages(), progress);
} catch (Exception e) {
Messages.showErrorDialog(SDK_PACKAGE_CLEANUP_FAILED, "Cleanup Error");
LOG.warn("Failed to make sure HAXM SDK package is uninstalled after HAXM wizard was cancelled", e);
}
}
super.doCancelAction();
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class VfsInstallListener method statusChanged.
@Override
public void statusChanged(@NonNull PackageOperation op, @NonNull ProgressIndicator progress) throws PackageOperation.StatusChangeListenerException {
if (op.getInstallStatus().equals(PackageOperation.InstallStatus.COMPLETE)) {
Task refreshTask = new Task.Backgroundable(null, "Refreshing...", false, PerformInBackgroundOption.ALWAYS_BACKGROUND) {
@Override
public void run(@NotNull com.intellij.openapi.progress.ProgressIndicator indicator) {
indicator.setIndeterminate(true);
doRefresh(op, progress);
}
};
ApplicationManager.getApplication().invokeLater(refreshTask::queue, ModalityState.NON_MODAL);
}
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class SdkBuildToolsTooLowErrorHandler method getQuickFixHyperlinks.
@NotNull
public List<NotificationHyperlink> getQuickFixHyperlinks(@NotNull String minimumVersion, @NotNull Project project, @Nullable Module module) {
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
boolean buildToolInstalled = false;
AndroidSdkHandler sdkHandler = null;
AndroidSdkData androidSdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
if (androidSdkData != null) {
sdkHandler = androidSdkData.getSdkHandler();
}
if (sdkHandler != null) {
ProgressIndicator progress = new StudioLoggerProgressIndicator(SdkBuildToolsTooLowErrorHandler.class);
RepositoryPackages packages = sdkHandler.getSdkManager(progress).getPackages();
LocalPackage buildTool = packages.getLocalPackages().get(getBuildToolsPath(parseRevision(minimumVersion)));
buildToolInstalled = buildTool != null;
}
if (module != null) {
VirtualFile buildFile = getGradleBuildFile(module);
AndroidPluginInfo androidPluginInfo = AndroidPluginInfo.find(project);
if (!buildToolInstalled) {
if (androidPluginInfo != null && androidPluginInfo.isExperimental()) {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, null));
} else {
hyperlinks.add(new InstallBuildToolsHyperlink(minimumVersion, buildFile));
}
} else if (buildFile != null && androidPluginInfo != null && !androidPluginInfo.isExperimental()) {
hyperlinks.add(new FixBuildToolsVersionHyperlink(buildFile, minimumVersion));
}
if (buildFile != null) {
hyperlinks.add(new OpenFileHyperlink(buildFile.getPath()));
}
}
return hyperlinks;
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class MissingPlatformErrorHandler method findAndAddQuickFixes.
private void findAndAddQuickFixes(@NotNull NotificationData notification, @NotNull Project project, @NotNull String text) {
String missingPlatform = getMissingPlatform(text);
if (missingPlatform == null) {
return;
}
String loadError = null;
List<NotificationHyperlink> hyperlinks = new ArrayList<>();
AndroidSdkHandler sdkHandler = null;
AndroidSdkData androidSdkData = AndroidSdks.getInstance().tryToChooseAndroidSdk();
if (androidSdkData != null) {
sdkHandler = androidSdkData.getSdkHandler();
}
if (sdkHandler != null) {
AndroidVersion version = AndroidTargetHash.getPlatformVersion(missingPlatform);
if (version != null) {
// Is the platform installed?
ProgressIndicator logger = new StudioLoggerProgressIndicator(getClass());
loadError = sdkHandler.getAndroidTargetManager(logger).getErrorForPackage(DetailsTypes.getPlatformPath(version));
hyperlinks.add(new InstallPlatformHyperlink(version));
}
}
if (hyperlinks.isEmpty()) {
// We are unable to install platform automatically.
List<AndroidFacet> facets = ProjectFacetManager.getInstance(project).getFacets(AndroidFacet.ID);
if (!facets.isEmpty()) {
// We can only open SDK manager if the project has an Android facet. Android facet has a reference to the Android SDK manager.
hyperlinks.add(new OpenAndroidSdkManagerHyperlink());
}
}
if (isNotEmpty(loadError)) {
text += "\nPossible cause: " + loadError;
}
SyncMessages.getInstance(project).updateNotification(notification, text, hyperlinks);
}
use of com.android.repository.api.ProgressIndicator in project android by JetBrains.
the class AndroidSdk method getLatestCompatibleBuildToolsPath.
/**
* Find latest build tools revision. Versions compatible with the selected platforms will be installed by the platform components.
* @return The Revision of the latest build tools package, or null if no remote build tools packages are available.
*/
@Nullable
private String getLatestCompatibleBuildToolsPath() {
ProgressIndicator progress = new ProgressIndicatorAdapter() {
};
RemotePackage latest = mySdkHandler.getLatestRemotePackageForPrefix(SdkConstants.FD_BUILD_TOOLS, false, progress);
return latest != null ? latest.getPath() : null;
}
Aggregations