Search in sources :

Example 1 with SingleStepPath

use of com.android.tools.idea.wizard.dynamic.SingleStepPath in project android by JetBrains.

the class FirstRunWizard method init.

@Override
public void init() {
    File initialSdkLocation = FirstRunWizardDefaults.getInitialSdkLocation(myMode);
    ConsolidatedProgressStep progressStep = new FirstRunProgressStep();
    myComponentsPath = new InstallComponentsPath(myMode, initialSdkLocation, progressStep, true);
    if (myMode == FirstRunWizardMode.NEW_INSTALL) {
        boolean sdkExists = false;
        if (initialSdkLocation.isDirectory()) {
            AndroidSdkHandler sdkHandler = AndroidSdkHandler.getInstance(initialSdkLocation);
            ProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
            sdkExists = ((AndroidSdkHandler) sdkHandler).getLocalPackage(SdkConstants.FD_TOOLS, progress) != null;
        }
        addPath(new SingleStepPath(new FirstRunWelcomeStep(sdkExists)));
    }
    if (myMode == FirstRunWizardMode.NEW_INSTALL) {
        if (initialSdkLocation.getPath().isEmpty()) {
            // We don't have a default path specified, have to do custom install.
            myState.put(KEY_CUSTOM_INSTALL, true);
        } else {
            addPath(new SingleStepPath(new InstallationTypeWizardStep(KEY_CUSTOM_INSTALL)));
        }
        addPath(new SingleStepPath(new SelectThemeStep(KEY_CUSTOM_INSTALL)));
    }
    if (myMode == FirstRunWizardMode.MISSING_SDK) {
        addPath(new SingleStepPath(new MissingSdkAlertStep()));
    }
    addPath(myComponentsPath);
    if (SystemInfo.isLinux && myMode == FirstRunWizardMode.NEW_INSTALL) {
        addPath(new SingleStepPath(new LinuxHaxmInfoStep()));
    }
    if (myMode != FirstRunWizardMode.INSTALL_HANDOFF) {
        addPath(new SingleStepPath(new LicenseAgreementStep(getDisposable())));
    }
    addPath(new SingleStepPath(progressStep));
    super.init();
}
Also used : SingleStepPath(com.android.tools.idea.wizard.dynamic.SingleStepPath) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) LicenseAgreementStep(com.android.tools.idea.sdk.wizard.legacy.LicenseAgreementStep) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) ProgressIndicator(com.android.repository.api.ProgressIndicator) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) File(java.io.File)

Example 2 with SingleStepPath

use of com.android.tools.idea.wizard.dynamic.SingleStepPath in project android by JetBrains.

the class NewModuleWizardDynamic method addPaths.

private void addPaths() {
    Collection<NewModuleDynamicPath> contributions = getContributedPaths();
    Iterable<ModuleTemplateProvider> templateProviders = Iterables.concat(ImmutableSet.of(new AndroidModuleTemplatesProvider()), contributions);
    addPath(new SingleStepPath(new ChooseModuleTypeStep(templateProviders, getDisposable())));
    for (NewFormFactorModulePath path : NewFormFactorModulePath.getAvailableFormFactorModulePaths(getDisposable())) {
        path.setGradleSyncIfNecessary(false);
        addPath(path);
    }
    for (NewModuleDynamicPath contribution : contributions) {
        addPath(contribution);
    }
}
Also used : SingleStepPath(com.android.tools.idea.wizard.dynamic.SingleStepPath) ChooseModuleTypeStep(com.android.tools.idea.npw.deprecated.ChooseModuleTypeStep) NewFormFactorModulePath(com.android.tools.idea.npw.deprecated.NewFormFactorModulePath)

Example 3 with SingleStepPath

use of com.android.tools.idea.wizard.dynamic.SingleStepPath in project android by JetBrains.

the class SdkUpdaterConfigPanel method setUpSingleSdkChooser.

private void setUpSingleSdkChooser() {
    myEditSdkLink.setHyperlinkText("Edit");
    myEditSdkLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        protected void hyperlinkActivated(HyperlinkEvent e) {
            final DynamicWizardHost host = new DialogWrapperHost(null);
            DynamicWizard wizard = new DynamicWizard(null, null, "SDK Setup", host) {

                @Override
                public void init() {
                    DownloadingComponentsStep progressStep = new DownloadingComponentsStep(myHost.getDisposable(), myHost);
                    String sdkPath = mySdkLocationTextField.getText();
                    File location;
                    if (StringUtil.isEmpty(sdkPath)) {
                        location = FirstRunWizardDefaults.getInitialSdkLocation(FirstRunWizardMode.MISSING_SDK);
                    } else {
                        location = new File(sdkPath);
                    }
                    InstallComponentsPath path = new InstallComponentsPath(FirstRunWizardMode.MISSING_SDK, location, progressStep, false);
                    progressStep.setInstallComponentsPath(path);
                    addPath(path);
                    addPath(new SingleStepPath(progressStep));
                    super.init();
                }

                @Override
                public void performFinishingActions() {
                    File sdkLocation = IdeSdks.getInstance().getAndroidSdkPath();
                    if (sdkLocation == null) {
                        return;
                    }
                    String stateSdkLocationPath = myState.get(WizardConstants.KEY_SDK_INSTALL_LOCATION);
                    assert stateSdkLocationPath != null;
                    File stateSdkLocation = new File(stateSdkLocationPath);
                    if (!FileUtil.filesEqual(sdkLocation, stateSdkLocation)) {
                        setAndroidSdkLocation(stateSdkLocation);
                        sdkLocation = stateSdkLocation;
                    }
                    mySelectedSdkLocation.setValue(sdkLocation);
                }

                @NotNull
                @Override
                protected String getProgressTitle() {
                    return "Setting up SDK...";
                }

                @Override
                protected String getWizardActionDescription() {
                    return "Setting up SDK...";
                }
            };
            wizard.init();
            wizard.show();
        }
    });
    mySdkLocationTextField.setEditable(false);
}
Also used : DynamicWizard(com.android.tools.idea.wizard.dynamic.DynamicWizard) SingleStepPath(com.android.tools.idea.wizard.dynamic.SingleStepPath) HyperlinkEvent(javax.swing.event.HyperlinkEvent) InstallComponentsPath(com.android.tools.idea.welcome.wizard.InstallComponentsPath) DialogWrapperHost(com.android.tools.idea.wizard.dynamic.DialogWrapperHost) DynamicWizardHost(com.android.tools.idea.wizard.dynamic.DynamicWizardHost) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull) HyperlinkAdapter(com.intellij.ui.HyperlinkAdapter)

Aggregations

SingleStepPath (com.android.tools.idea.wizard.dynamic.SingleStepPath)3 File (java.io.File)2 ProgressIndicator (com.android.repository.api.ProgressIndicator)1 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)1 ChooseModuleTypeStep (com.android.tools.idea.npw.deprecated.ChooseModuleTypeStep)1 NewFormFactorModulePath (com.android.tools.idea.npw.deprecated.NewFormFactorModulePath)1 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)1 LicenseAgreementStep (com.android.tools.idea.sdk.wizard.legacy.LicenseAgreementStep)1 InstallComponentsPath (com.android.tools.idea.welcome.wizard.InstallComponentsPath)1 DialogWrapperHost (com.android.tools.idea.wizard.dynamic.DialogWrapperHost)1 DynamicWizard (com.android.tools.idea.wizard.dynamic.DynamicWizard)1 DynamicWizardHost (com.android.tools.idea.wizard.dynamic.DynamicWizardHost)1 HyperlinkAdapter (com.intellij.ui.HyperlinkAdapter)1 HyperlinkEvent (javax.swing.event.HyperlinkEvent)1 NotNull (org.jetbrains.annotations.NotNull)1