Search in sources :

Example 1 with RepoProgressIndicatorAdapter

use of com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter in project android by JetBrains.

the class InstallComponentsPath method createComponentTree.

private ComponentTreeNode createComponentTree(@NotNull FirstRunWizardMode reason, @NotNull ScopedStateStore stateStore, boolean createAvd) {
    List<ComponentTreeNode> components = Lists.newArrayList();
    components.add(new AndroidSdk(stateStore, myInstallUpdates));
    DynamicWizard wizard = getWizard();
    ProgressWindow progressWindow = new ProgressWindow(false, false, null);
    if (wizard != null) {
        Disposer.register(wizard.getDisposable(), progressWindow);
    }
    com.android.repository.api.ProgressIndicator progress = new RepoProgressIndicatorAdapter(progressWindow);
    RepoManager sdkManager = myLocalHandler.getSdkManager(new StudioLoggerProgressIndicator(getClass()));
    sdkManager.loadSynchronously(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, progress, new StudioDownloader(progressWindow), StudioSettingsController.getInstance());
    Map<String, RemotePackage> remotePackages = sdkManager.getPackages().getRemotePackages();
    ComponentTreeNode platforms = Platform.createSubtree(stateStore, remotePackages, myInstallUpdates);
    if (platforms != null) {
        components.add(platforms);
    }
    if (Haxm.canRun() && reason == FirstRunWizardMode.NEW_INSTALL) {
        Haxm.HaxmInstallationIntention haxmInstallationIntention = myInstallUpdates ? Haxm.HaxmInstallationIntention.INSTALL_WITH_UPDATES : Haxm.HaxmInstallationIntention.INSTALL_WITHOUT_UPDATES;
        components.add(new Haxm(haxmInstallationIntention, stateStore, FirstRunWizard.KEY_CUSTOM_INSTALL));
    }
    if (createAvd) {
        components.add(new AndroidVirtualDevice(stateStore, remotePackages, myInstallUpdates, myFileOp));
    }
    return new ComponentCategory("Root", "Root node that is not supposed to appear in the UI", components);
}
Also used : StudioDownloader(com.android.tools.idea.sdk.StudioDownloader) DynamicWizard(com.android.tools.idea.wizard.dynamic.DynamicWizard) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) RepoManager(com.android.repository.api.RepoManager) RepoProgressIndicatorAdapter(com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter) ProgressWindow(com.intellij.openapi.progress.util.ProgressWindow) RemotePackage(com.android.repository.api.RemotePackage)

Example 2 with RepoProgressIndicatorAdapter

use of com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter in project android by JetBrains.

the class SdkComponentSource method initIfNecessary.

private void initIfNecessary(@Nullable ProgressIndicator indicator) {
    RepoManager mgr = getRepoManager();
    com.android.repository.api.ProgressIndicator progress;
    if (indicator != null) {
        progress = new RepoProgressIndicatorAdapter(indicator);
    } else {
        progress = LOGGER;
    }
    if (mgr.loadSynchronously(TimeUnit.MINUTES.toMillis(1), progress, getDownloader(indicator), getSettingsController())) {
        myPackages = mgr.getPackages();
    }
}
Also used : RepoProgressIndicatorAdapter(com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter) com.android.repository.api(com.android.repository.api)

Example 3 with RepoProgressIndicatorAdapter

use of com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter in project android by JetBrains.

the class SourcesTableModel method save.

/**
   * Save any changes the user has made.
   */
public void save(@NotNull ProgressIndicator progress) {
    if (isSourcesModified()) {
        RepositorySourceProvider userSourceProvider = getUserSourceProvider();
        // we know it won't be null since otherwise we shouldn't have been editable
        assert userSourceProvider != null;
        userSourceProvider.save(new RepoProgressIndicatorAdapter(progress));
        reset();
    }
}
Also used : RepoProgressIndicatorAdapter(com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter) RepositorySourceProvider(com.android.repository.api.RepositorySourceProvider)

Aggregations

RepoProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.RepoProgressIndicatorAdapter)3 com.android.repository.api (com.android.repository.api)1 RemotePackage (com.android.repository.api.RemotePackage)1 RepoManager (com.android.repository.api.RepoManager)1 RepositorySourceProvider (com.android.repository.api.RepositorySourceProvider)1 StudioDownloader (com.android.tools.idea.sdk.StudioDownloader)1 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)1 DynamicWizard (com.android.tools.idea.wizard.dynamic.DynamicWizard)1 ProgressWindow (com.intellij.openapi.progress.util.ProgressWindow)1