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();
}
}
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);
}
}
}
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();
}
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();
}
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();
}
Aggregations