Search in sources :

Example 11 with ModuleWizardStep

use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.

the class ProjectWizardTestCase method runWizard.

protected void runWizard(@Nullable Consumer<Step> adjuster) {
    while (true) {
        ModuleWizardStep currentStep = myWizard.getCurrentStepObject();
        if (adjuster != null) {
            adjuster.consume(currentStep);
        }
        if (myWizard.isLast()) {
            break;
        }
        myWizard.doNextAction();
        if (currentStep == myWizard.getCurrentStepObject()) {
            throw new RuntimeException(currentStep + " is not validated");
        }
    }
    myWizard.doFinishAction();
}
Also used : ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep)

Example 12 with ModuleWizardStep

use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project intellij-community by JetBrains.

the class JavaProjectStructureDetector method createWizardSteps.

@Override
public List<ModuleWizardStep> createWizardSteps(ProjectFromSourcesBuilder builder, ProjectDescriptor projectDescriptor, Icon stepIcon) {
    final List<ModuleWizardStep> steps = new ArrayList<>();
    final ModuleInsight moduleInsight = new JavaModuleInsight(new DelegatingProgressIndicator(), builder.getExistingModuleNames(), builder.getExistingProjectLibraryNames());
    steps.add(new LibrariesDetectionStep(builder, projectDescriptor, moduleInsight, stepIcon, "reference.dialogs.new.project.fromCode.page1"));
    steps.add(new ModulesDetectionStep(this, builder, projectDescriptor, moduleInsight, stepIcon, "reference.dialogs.new.project.fromCode.page2"));
    if (builder.getContext().isCreatingNewProject()) {
        final ModuleWizardStep jdkStep = ProjectWizardStepFactory.getInstance().createProjectJdkStep(builder.getContext());
        steps.add(jdkStep);
        if (jdkStep instanceof ProjectJdkStep) {
            ((ProjectJdkStep) jdkStep).setProjectDescriptor(projectDescriptor);
        }
    }
    return steps;
}
Also used : DelegatingProgressIndicator(com.intellij.ide.util.DelegatingProgressIndicator) ProjectJdkStep(com.intellij.ide.util.projectWizard.ProjectJdkStep) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) ArrayList(java.util.ArrayList)

Example 13 with ModuleWizardStep

use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project android by JetBrains.

the class TemplateWizard method init.

@Override
protected void init() {
    super.init();
    int currentStep = getCurrentStep();
    if (currentStep >= mySteps.size()) {
        return;
    }
    ModuleWizardStep step = mySteps.get(currentStep);
    if (step instanceof TemplateWizardStep) {
        ((TemplateWizardStep) step).update();
    }
}
Also used : ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep)

Example 14 with ModuleWizardStep

use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project android by JetBrains.

the class AndroidWizardWrapper method getCustomOptionsStep.

@Nullable
@Override
public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
    if (myWizard == null) {
        WizardHostDelegate host = new WizardHostDelegate(context.getWizard());
        myWizard = context.isCreatingNewProject() ? new ProjectWizard(context.getProject(), host) : new ModuleWizard(context.getProject(), host);
        myWizard.init();
    }
    return new ModuleWizardStep() {

        @Override
        public JComponent getComponent() {
            return (JComponent) myWizard.getContentPane();
        }

        @Override
        public void updateDataModel() {
        }

        @Override
        public String getHelpId() {
            if (myWizard == null || myWizard.getCurrentPath() == null)
                return null;
            Step step = myWizard.getCurrentPath().getCurrentStep();
            if (step instanceof DynamicWizardStep) {
                String name = ((DynamicWizardStep) step).getStepName();
                if ("Create Android Project".equals(name)) {
                    return "New_Project_Dialog";
                }
                if ("Configure Form Factors".equals(name)) {
                    return "Target_Android_Devices";
                }
                if ("Activity Gallery".equals(name)) {
                    return "Add_an_Activity_Dialog";
                }
                if ("Template parameters".equals(name)) {
                    return "Customize_the_Activity";
                }
            }
            return null;
        }
    };
}
Also used : ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) Step(com.intellij.ide.wizard.Step) SettingsStep(com.intellij.ide.util.projectWizard.SettingsStep) Nullable(org.jetbrains.annotations.Nullable)

Example 15 with ModuleWizardStep

use of com.intellij.ide.util.projectWizard.ModuleWizardStep in project android by JetBrains.

the class NewModuleWizardTest method testBuildChooseModuleStep.

public void testBuildChooseModuleStep() throws Exception {
    File otherTemplateDir = new File(TemplateManager.getTemplateRootFolder(), Template.CATEGORY_PROJECTS);
    List<String> templateDirFiles = Arrays.asList(otherTemplateDir.list((file, name) -> !name.startsWith(".")));
    int expectedCount = templateDirFiles.size() - 3 + 3;
    WrapArchiveWizardPath wrapArchiveWizardPath = new WrapArchiveWizardPath(new NewModuleWizardState(), getProject(), () -> {
    }, null);
    expectedCount += wrapArchiveWizardPath.getBuiltInTemplates().size();
    ArrayList<ModuleWizardStep> steps = Lists.newArrayList();
    TemplateWizardModuleBuilder myModuleBuilder = new TemplateWizardModuleBuilder(null, myModule.getProject(), AndroidIcons.Wizards.NewModuleSidePanel, steps, getTestRootDisposable(), false) {

        @Override
        public void update() {
        // Do nothing
        }
    };
    assertInstanceOf(steps.get(0), ChooseTemplateStep.class);
    ChooseTemplateStep chooseTemplateStep = (ChooseTemplateStep) steps.get(0);
    // Make sure we've got an actual object
    assertNotNull(chooseTemplateStep);
    DefaultListModel templateMetadatas = (DefaultListModel) chooseTemplateStep.myTemplateList.getModel();
    Set<String> templateNames = new HashSet<>(templateMetadatas.getSize());
    for (Object o : templateMetadatas.toArray()) {
        templateNames.add(o.toString());
    }
    // Make sure we have the right number of choices
    assertEquals(expectedCount, templateMetadatas.getSize());
    // Ensure we're not offering duplicate elements in the list
    assertEquals(templateNames.size(), templateMetadatas.getSize());
}
Also used : Arrays(java.util.Arrays) HashSet(com.intellij.util.containers.HashSet) Set(java.util.Set) IOException(java.io.IOException) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) File(java.io.File) ArrayList(java.util.ArrayList) List(java.util.List) Lists(com.google.common.collect.Lists) SystemProperties(com.intellij.util.SystemProperties) AndroidIcons(icons.AndroidIcons) Template(com.android.tools.idea.templates.Template) TemplateManager(com.android.tools.idea.templates.TemplateManager) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath) FileUtil(com.intellij.openapi.util.io.FileUtil) AndroidTestCase(org.jetbrains.android.AndroidTestCase) javax.swing(javax.swing) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) File(java.io.File) WrapArchiveWizardPath(com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath) HashSet(com.intellij.util.containers.HashSet)

Aggregations

ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)27 Project (com.intellij.openapi.project.Project)5 ArrayList (java.util.ArrayList)5 ConfigurationException (com.intellij.openapi.options.ConfigurationException)3 DelegatingProgressIndicator (com.intellij.ide.util.DelegatingProgressIndicator)2 ProjectBuilder (com.intellij.ide.util.projectWizard.ProjectBuilder)2 ProjectWizardStepFactory (com.intellij.ide.util.projectWizard.ProjectWizardStepFactory)2 SettingsStep (com.intellij.ide.util.projectWizard.SettingsStep)2 WizardContext (com.intellij.ide.util.projectWizard.WizardContext)2 ProjectStructureDetector (com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector)2 Step (com.intellij.ide.wizard.Step)2 Module (com.intellij.openapi.module.Module)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 ModuleImporter (com.android.tools.idea.gradle.project.ModuleImporter)1 WrapArchiveWizardPath (com.android.tools.idea.npw.deprecated.WrapArchiveWizardPath)1 Template (com.android.tools.idea.templates.Template)1 TemplateManager (com.android.tools.idea.templates.TemplateManager)1 ModelWizardStep (com.android.tools.idea.wizard.model.ModelWizardStep)1