use of com.android.tools.idea.sdk.progress.StudioProgressRunner in project android by JetBrains.
the class StudioSdkUtil method reloadRemoteSdkWithModalProgress.
/**
* Convenience method to reload the local and remote SDK, showing a modal, non-cancellable progress window.
*/
public static void reloadRemoteSdkWithModalProgress() {
final AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
StudioProgressRunner runner = new StudioProgressRunner(true, false, "Refreshing SDK", false, null);
StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(StudioSdkUtil.class);
RepoManager sdkManager = sdkHandler.getSdkManager(progress);
sdkManager.load(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, null, null, null, runner, new StudioDownloader(null), StudioSettingsController.getInstance(), true);
}
use of com.android.tools.idea.sdk.progress.StudioProgressRunner in project android by JetBrains.
the class FormFactorApiComboBox method loadRemoteTargets.
private void loadRemoteTargets(final int minSdkLevel, final Runnable completedCallback, final Runnable foundItemsCallback, final Runnable noItemsCallback) {
AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
final Runnable runCallbacks = () -> {
if (completedCallback != null) {
completedCallback.run();
}
if (getItemCount() > 0) {
if (foundItemsCallback != null) {
foundItemsCallback.run();
}
} else {
if (noItemsCallback != null) {
noItemsCallback.run();
}
}
};
RepoManager.RepoLoadedCallback onComplete = packages -> {
addPackages(packages.getNewPkgs(), minSdkLevel);
addOfflineLevels();
loadSavedApi();
runCallbacks.run();
};
// We need to pick up addons that don't have a target created due to the base platform not being installed.
RepoManager.RepoLoadedCallback onLocalComplete = packages -> addPackages(packages.getLocalPackages().values(), minSdkLevel);
Runnable onError = () -> ApplicationManager.getApplication().invokeLater(() -> {
addOfflineLevels();
runCallbacks.run();
}, ModalityState.any());
StudioProgressRunner runner = new StudioProgressRunner(false, false, "Refreshing Targets", true, null);
sdkHandler.getSdkManager(REPO_LOG).load(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, ImmutableList.of(onLocalComplete), ImmutableList.of(onComplete), ImmutableList.of(onError), runner, new StudioDownloader(), StudioSettingsController.getInstance(), false);
}
use of com.android.tools.idea.sdk.progress.StudioProgressRunner in project android by JetBrains.
the class SdkUpdaterConfigPanel method refresh.
/**
* Revalidates and refreshes our packages. Notifies platform and tools components of the start and end, so they can update their UIs.
*/
public void refresh() {
validate();
myPlatformComponentsPanel.startLoading();
myToolComponentsPanel.startLoading();
// TODO: make progress runner handle invokes?
Project[] projects = ProjectManager.getInstance().getOpenProjects();
StudioProgressRunner progressRunner = new StudioProgressRunner(false, false, "Loading SDK", false, projects.length == 0 ? null : projects[0]);
myConfigurable.getRepoManager().load(0, ImmutableList.of(myLocalUpdater), ImmutableList.of(myRemoteUpdater), null, progressRunner, myDownloader, mySettings, false);
}
Aggregations