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