use of com.intellij.ide.util.newProjectWizard.TemplatesGroup in project liferay-ide by liferay.
the class LiferayProjectTypeStep method _fillTemplatesMap.
private List<TemplatesGroup> _fillTemplatesMap() {
_templatesMap.put(new TemplatesGroup(new LiferayModuleBuilder()), new ArrayList<>());
_templatesMap.put(new TemplatesGroup(new LiferayModuleFragmentBuilder()), new ArrayList<>());
List<TemplatesGroup> groups = new ArrayList<>(_templatesMap.keySet());
MultiMap<ModuleType, TemplatesGroup> moduleTypes = new MultiMap<>();
for (TemplatesGroup group : groups) {
ModuleType type = _getModuleType(group);
moduleTypes.putValue(type, group);
}
return groups;
}
use of com.intellij.ide.util.newProjectWizard.TemplatesGroup in project liferay-ide by liferay.
the class LiferayProjectTypeStep method getTemplatesMap.
public static MultiMap<TemplatesGroup, ProjectTemplate> getTemplatesMap(WizardContext context) {
MultiMap<TemplatesGroup, ProjectTemplate> groups = new MultiMap<>();
for (ProjectTemplatesFactory factory : ProjectTemplatesFactory.EP_NAME.getExtensions()) {
Stream<String> stream = Stream.of(factory.getGroups());
stream.map(group -> new AbstractMap.SimpleEntry<>(group, factory.createTemplates(group, context))).filter(pair -> !CoreUtil.isNullOrEmpty(pair.getValue())).forEach(pair -> {
String group = pair.getKey();
Icon icon = factory.getGroupIcon(group);
String parentGroup = factory.getParentGroup(group);
TemplatesGroup templatesGroup = new TemplatesGroup(group, null, icon, factory.getGroupWeight(group), parentGroup, group, null);
groups.putValues(templatesGroup, Arrays.asList(pair.getValue()));
});
}
return groups;
}
use of com.intellij.ide.util.newProjectWizard.TemplatesGroup 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