public SelectTemplateStep( WizardContext context, StepSequence sequence, final MultiMap<TemplatesGroup, ProjectTemplate> map) { myWizardContext = context; mySequence = sequence; Messages.installHyperlinkSupport(myDescriptionPane); myFormatPanel = new ProjectFormatPanel(); myNamePathComponent = initNamePathComponent(context); if (context.isCreatingNewProject()) { mySettingsPanel.add(myNamePathComponent, BorderLayout.NORTH); addExpertPanel(myModulePanel); } else { mySettingsPanel.add(myModulePanel, BorderLayout.NORTH); } bindModuleSettings(); myExpertDecorator = new HideableDecorator(myExpertPlaceholder, "Mor&e Settings", false); myExpertPanel.setBorder( IdeBorderFactory.createEmptyBorder(0, IdeBorderFactory.TITLED_BORDER_INDENT, 5, 0)); myExpertDecorator.setContentComponent(myExpertPanel); myList = new ProjectTypesList(myTemplatesList, map, context); myList.installKeyAction(getNameComponent()); myTemplatesList .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { ProjectTemplate template = getSelectedTemplate(); boolean loading = template instanceof LoadingProjectTemplate; myModuleBuilder = template == null || loading ? null : template.createModuleBuilder(); setupPanels(template); mySequence.setType(myModuleBuilder == null ? null : myModuleBuilder.getBuilderId()); myWizardContext.requestWizardButtonsUpdate(); } }); if (myWizardContext.isCreatingNewProject()) { addProjectFormat(myModulePanel); } }
@TestOnly public boolean setSelectedTemplate(String group, String name) { return myList.setSelectedTemplate(group, name); }
@Override public void onStepLeaving() { SelectTemplateSettings settings = SelectTemplateSettings.getInstance(); settings.EXPERT_MODE = myExpertDecorator.isExpanded(); myList.saveSelection(); }
@Nullable public ProjectTemplate getSelectedTemplate() { return myList.getSelectedTemplate(); }
@Override public void updateStep() { myList.resetSelection(); myExpertDecorator.setOn(SelectTemplateSettings.getInstance().EXPERT_MODE); }