use of com.intellij.ide.projectWizard.ProjectCategory in project liferay-ide by liferay.
the class LiferayProjectTypeStep method projectTypeChanged.
public void projectTypeChanged() {
TemplatesGroup group = _getSelectedGroup();
if ((group == null) || (group == _lastSelectedGroup)) {
return;
}
_lastSelectedGroup = group;
PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
propertiesComponent.setValue(_PROJECT_WIZARD_GROUP, group.getId());
ModuleBuilder groupModuleBuilder = group.getModuleBuilder();
_settingsStep = null;
_headerPanel.removeAll();
if ((groupModuleBuilder != null) && (groupModuleBuilder.getModuleType() != null)) {
_settingsStep = groupModuleBuilder.modifyProjectTypeStep(this);
}
if ((groupModuleBuilder == null) || groupModuleBuilder.isTemplateBased()) {
_showTemplates(group);
} else if (!_showCustomOptions(groupModuleBuilder)) {
List<FrameworkSupportInModuleProvider> providers = FrameworkSupportUtil.getProviders(groupModuleBuilder);
ProjectCategory category = group.getProjectCategory();
if (category != null) {
List<FrameworkSupportInModuleProvider> filtered = ContainerUtil.filter(providers, provider -> _matchFramework(category, provider));
Map<String, FrameworkSupportInModuleProvider> map = ContainerUtil.newMapFromValues(providers.iterator(), PROVIDER_STRING_CONVERTOR);
Stream<FrameworkSupportInModuleProvider> stream = filtered.stream();
Set<FrameworkSupportInModuleProvider> set = stream.flatMap(provider -> provider.getDependenciesFrameworkIds().stream()).map(depId -> map.get(depId.getFrameworkId())).filter(dependency -> dependency != null).collect(Collectors.toSet());
_frameworksPanel.setProviders(new ArrayList<>(set), new HashSet<>(Arrays.asList(category.getAssociatedFrameworkIds())), new HashSet<>(Arrays.asList(category.getPreselectedFrameworkIds())));
} else {
_frameworksPanel.setProviders(providers);
}
_getSelectedBuilder().addModuleConfigurationUpdater(_configurationUpdater);
_showCard(_FRAMEWORKS_CARD);
}
_headerPanel.setVisible(_headerPanel.getComponentCount() > 0);
List<JLabel> labels = UIUtil.findComponentsOfType(_headerPanel, JLabel.class);
int width = 0;
for (JLabel label : labels) {
int width1 = label.getPreferredSize().width;
width = Math.max(width, width1);
}
for (JLabel label : labels) {
label.setPreferredSize(new Dimension(width, label.getPreferredSize().height));
}
_headerPanel.revalidate();
_headerPanel.repaint();
_updateSelection();
}
Aggregations