Search in sources :

Example 1 with Step

use of com.intellij.ide.wizard.Step in project android by JetBrains.

the class DynamicWizard method showNextStep.

@Nullable
private Step showNextStep(@Nullable AndroidStudioWizardPath path) {
    Step newStep = null;
    if (path != null) {
        newStep = path.next();
    }
    if (newStep == null) {
        newStep = null;
        while (myPathListIterator.hasNext() && newStep == null) {
            myCurrentPath = myPathListIterator.next();
            assert myCurrentPath != null;
            myCurrentPath.onPathStarted(true);
            newStep = myCurrentPath.getCurrentStep();
        }
    }
    if (newStep != null) {
        showStep(newStep);
    }
    return newStep;
}
Also used : Step(com.intellij.ide.wizard.Step) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with Step

use of com.intellij.ide.wizard.Step 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 3 with Step

use of com.intellij.ide.wizard.Step in project android by JetBrains.

the class DynamicWizard method doPreviousAction.

/**
   * Find and go to the previous step. Subclasses should rarely need to override
   * this method.
   */
public final void doPreviousAction() {
    assert myCurrentPath != null;
    if (!myCurrentPath.canGoPrevious()) {
        myHost.shakeWindow();
        return;
    }
    Step newStep = myCurrentPath.previous();
    if (newStep == null) {
        while (myPathListIterator.hasPrevious() && newStep == null) {
            myCurrentPath = myPathListIterator.previous();
            assert myCurrentPath != null;
            myCurrentPath.onPathStarted(false);
            newStep = myCurrentPath.getCurrentStep();
        }
    }
    if (newStep != null) {
        showStep(newStep);
    } else {
        LOG.error("Stepped into Path " + myCurrentPath + " which returned a null step");
    }
}
Also used : Step(com.intellij.ide.wizard.Step)

Example 4 with Step

use of com.intellij.ide.wizard.Step in project android by JetBrains.

the class DynamicWizard method init.

public void init() {
    myHost.init(this);
    myIsInitialized = true;
    if (myUpdateQueue != null) {
        int guard = 0;
        // error so we need to detect it and report to developer.
        while (!myUpdateQueue.isEmpty()) {
            myUpdateQueue.flush();
            guard++;
            if (guard >= MAX_UPDATE_ATTEMPTS) {
                throw new IllegalStateException("Circular dependencies detected. Model state cannot be settled down.");
            }
        }
    }
    Step step = showNextStep(null);
    assert step != null;
}
Also used : Step(com.intellij.ide.wizard.Step)

Example 5 with Step

use of com.intellij.ide.wizard.Step in project intellij-community by JetBrains.

the class GradleProjectWizardTest method testGradleProject.

public void testGradleProject() throws Exception {
    final String projectName = "testProject";
    Project project = createProject(new Consumer<Step>() {

        @Override
        public void consume(Step step) {
            if (step instanceof ProjectTypeStep) {
                assertTrue(((ProjectTypeStep) step).setSelectedTemplate("Gradle", null));
                List<ModuleWizardStep> steps = myWizard.getSequence().getSelectedSteps();
                assertEquals(5, steps.size());
                final ProjectBuilder projectBuilder = myWizard.getProjectBuilder();
                assertInstanceOf(projectBuilder, GradleModuleBuilder.class);
                ((GradleModuleBuilder) projectBuilder).setName(projectName);
            }
        }
    });
    assertEquals(projectName, project.getName());
    Module[] modules = ModuleManager.getInstance(project).getModules();
    assertEquals(1, modules.length);
    final Module module = modules[0];
    assertTrue(ModuleRootManager.getInstance(module).isSdkInherited());
    assertEquals(projectName, module.getName());
    VirtualFile root = ProjectRootManager.getInstance(project).getContentRoots()[0];
    VirtualFile settingsScript = VfsUtilCore.findRelativeFile("settings.gradle", root);
    assertNotNull(settingsScript);
    assertEquals(String.format("rootProject.name = '%s'\n\n", projectName), StringUtil.convertLineSeparators(VfsUtilCore.loadText(settingsScript)));
    VirtualFile buildScript = VfsUtilCore.findRelativeFile("build.gradle", root);
    assertNotNull(buildScript);
    assertEquals("group '" + projectName + "'\n" + "version '1.0-SNAPSHOT'\n" + "\n" + "apply plugin: 'java'\n" + "\n" + "sourceCompatibility = 1.8\n" + "\n" + "repositories {\n" + "    mavenCentral()\n" + "}\n" + "\n" + "dependencies {\n" + "    testCompile group: 'junit', name: 'junit', version: '4.12'\n" + "}\n", StringUtil.convertLineSeparators(VfsUtilCore.loadText(buildScript)));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) GradleModuleBuilder(org.jetbrains.plugins.gradle.service.project.wizard.GradleModuleBuilder) ProjectBuilder(com.intellij.ide.util.projectWizard.ProjectBuilder) List(java.util.List) ProjectTypeStep(com.intellij.ide.projectWizard.ProjectTypeStep) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) Step(com.intellij.ide.wizard.Step) Module(com.intellij.openapi.module.Module) ProjectTypeStep(com.intellij.ide.projectWizard.ProjectTypeStep)

Aggregations

Step (com.intellij.ide.wizard.Step)5 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)2 Nullable (org.jetbrains.annotations.Nullable)2 ProjectTypeStep (com.intellij.ide.projectWizard.ProjectTypeStep)1 ProjectBuilder (com.intellij.ide.util.projectWizard.ProjectBuilder)1 SettingsStep (com.intellij.ide.util.projectWizard.SettingsStep)1 Module (com.intellij.openapi.module.Module)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 List (java.util.List)1 GradleModuleBuilder (org.jetbrains.plugins.gradle.service.project.wizard.GradleModuleBuilder)1