Search in sources :

Example 6 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class AndroidAssetStudioAction method actionPerformed.

@Override
public final void actionPerformed(AnActionEvent e) {
    final DataContext dataContext = e.getDataContext();
    final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view == null) {
        return;
    }
    final Module module = LangDataKeys.MODULE.getData(dataContext);
    if (module == null) {
        return;
    }
    AndroidFacet facet = AndroidFacet.getInstance(module);
    if (facet == null) {
        return;
    }
    ModelWizard wizard = createWizard(facet);
    if (wizard != null) {
        StudioWizardDialogBuilder dialogBuilder = new StudioWizardDialogBuilder(wizard, "Asset Studio");
        dialogBuilder.setProject(facet.getModule().getProject()).setMinimumSize(getWizardSize()).setHelpUrl(getHelpUrl());
        dialogBuilder.build().show();
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) StudioWizardDialogBuilder(com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder) IdeView(com.intellij.ide.IdeView) Module(com.intellij.openapi.module.Module) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard)

Example 7 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class AndroidNewProjectAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    // TODO: Temporary! This will be the main code path after we completely convert over NewProjectWizardDynamic
    if (Boolean.getBoolean("use.npw.modelwizard") && (e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
        NewProjectModel model = new NewProjectModel();
        ModelWizard wizard = new ModelWizard.Builder().addStep(new ConfigureAndroidProjectStep(model)).build();
        new StudioWizardDialogBuilder(wizard, "Create New Project").build().show();
    } else {
        try {
            NewProjectWizardDynamic dialog = new NewProjectWizardDynamic(null, null);
            dialog.init();
            dialog.show();
        } catch (IllegalStateException error) {
            Logger.getInstance(AndroidNewProjectAction.class).warn("Unable to launch New Project Wizard", error);
        }
    }
}
Also used : NewProjectWizardDynamic(com.android.tools.idea.npw.NewProjectWizardDynamic) StudioWizardDialogBuilder(com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder) StudioWizardDialogBuilder(com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder) NewProjectModel(com.android.tools.idea.npw.project.NewProjectModel) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard) ConfigureAndroidProjectStep(com.android.tools.idea.npw.project.ConfigureAndroidProjectStep)

Example 8 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class AvdWizardUtils method createAvdWizard.

/**
   * Creates a {@link ModelWizardDialog} containing all the steps needed to create or edit AVDs
   */
public static ModelWizardDialog createAvdWizard(@Nullable Component parent, @Nullable Project project, @NotNull AvdOptionsModel model) {
    ModelWizard.Builder wizardBuilder = new ModelWizard.Builder();
    if (!model.isInEditMode().get()) {
        wizardBuilder.addStep(new ChooseDeviceDefinitionStep(model));
        wizardBuilder.addStep(new ChooseSystemImageStep(model, project));
    }
    wizardBuilder.addStep(new ConfigureAvdOptionsStep(project, model));
    ModelWizard wizard = wizardBuilder.build();
    StudioWizardDialogBuilder builder = new StudioWizardDialogBuilder(wizard, "Virtual Device Configuration", parent);
    builder.setMinimumSize(AVD_WIZARD_SIZE);
    return builder.setHelpUrl(WizardUtils.toUrl(AVD_WIZARD_HELP_URL)).build();
}
Also used : StudioWizardDialogBuilder(com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder) StudioWizardDialogBuilder(com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard)

Example 9 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class NewImageAssetAction method createWizard.

@NotNull
@Override
protected ModelWizard createWizard(@NotNull AndroidFacet facet) {
    ModelWizard.Builder wizardBuilder = new ModelWizard.Builder();
    wizardBuilder.addStep(new NewImageAssetStep(new GenerateImageIconsModel(facet), facet));
    return wizardBuilder.build();
}
Also used : GenerateImageIconsModel(com.android.tools.idea.npw.assetstudio.wizard.GenerateImageIconsModel) NewImageAssetStep(com.android.tools.idea.npw.assetstudio.wizard.NewImageAssetStep) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with ModelWizard

use of com.android.tools.idea.wizard.model.ModelWizard in project android by JetBrains.

the class NewVectorAssetAction method createWizard.

@Nullable
@Override
protected ModelWizard createWizard(@NotNull AndroidFacet facet) {
    Module module = facet.getModule();
    Project project = module.getProject();
    AndroidModuleModel androidModel = AndroidModuleModel.get(module);
    if (androidModel != null) {
        AndroidVersion minSdkVersion = androidModel.getMinSdkVersion();
        String version = androidModel.getAndroidProject().getModelVersion();
        GradleVersion revision = GradleVersion.parse(version);
        if (revision.compareIgnoringQualifiers(VECTOR_ASSET_GENERATION_REVISION) < 0 && (minSdkVersion == null || minSdkVersion.getApiLevel() < VECTOR_DRAWABLE_API_LEVEL)) {
            Messages.showErrorDialog(project, ERROR_MESSAGE, ERROR_TITLE);
            return null;
        }
    }
    ModelWizard.Builder wizardBuilder = new ModelWizard.Builder();
    wizardBuilder.addStep(new NewVectorAssetStep(new GenerateVectorIconModel(facet), facet));
    return wizardBuilder.build();
}
Also used : Project(com.intellij.openapi.project.Project) NewVectorAssetStep(com.android.tools.idea.npw.assetstudio.wizard.NewVectorAssetStep) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) GenerateVectorIconModel(com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel) Module(com.intellij.openapi.module.Module) AndroidVersion(com.android.sdklib.AndroidVersion) GradleVersion(com.android.ide.common.repository.GradleVersion) ModelWizard(com.android.tools.idea.wizard.model.ModelWizard) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ModelWizard (com.android.tools.idea.wizard.model.ModelWizard)13 StudioWizardDialogBuilder (com.android.tools.idea.ui.wizard.StudioWizardDialogBuilder)7 Module (com.intellij.openapi.module.Module)3 Project (com.intellij.openapi.project.Project)3 NewModuleModel (com.android.tools.idea.npw.module.NewModuleModel)2 AbstractWizard (com.intellij.ide.wizard.AbstractWizard)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 Nullable (org.jetbrains.annotations.Nullable)2 VisibleForTesting (com.android.annotations.VisibleForTesting)1 GradleVersion (com.android.ide.common.repository.GradleVersion)1 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)1 AndroidVersion (com.android.sdklib.AndroidVersion)1 NewAndroidComponentAction (com.android.tools.idea.actions.NewAndroidComponentAction)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 NewAndroidActivityWizard (com.android.tools.idea.npw.NewAndroidActivityWizard)1 NewProjectWizardDynamic (com.android.tools.idea.npw.NewProjectWizardDynamic)1 GenerateImageIconsModel (com.android.tools.idea.npw.assetstudio.wizard.GenerateImageIconsModel)1 GenerateVectorIconModel (com.android.tools.idea.npw.assetstudio.wizard.GenerateVectorIconModel)1 NewImageAssetStep (com.android.tools.idea.npw.assetstudio.wizard.NewImageAssetStep)1 NewVectorAssetStep (com.android.tools.idea.npw.assetstudio.wizard.NewVectorAssetStep)1