Search in sources :

Example 1 with ProjectCategory

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();
}
Also used : UIUtil(com.intellij.util.ui.UIUtil) CommitStepException(com.intellij.ide.wizard.CommitStepException) Arrays(java.util.Arrays) THashMap(gnu.trove.THashMap) JBLabel(com.intellij.ui.components.JBLabel) WizardDelegate(com.intellij.ide.util.newProjectWizard.WizardDelegate) AddSupportForFrameworksPanel(com.intellij.ide.util.newProjectWizard.AddSupportForFrameworksPanel) ModuleWizardStep(com.intellij.ide.util.projectWizard.ModuleWizardStep) ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) Map(java.util.Map) Disposer(com.intellij.openapi.util.Disposer) Logger(com.intellij.openapi.diagnostic.Logger) Module(com.intellij.openapi.module.Module) ListSelectionEvent(javax.swing.event.ListSelectionEvent) MultiMap(com.intellij.util.containers.MultiMap) TemplatesGroup(com.intellij.ide.util.newProjectWizard.TemplatesGroup) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) LibrariesContainerFactory(com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainerFactory) Collection(java.util.Collection) BuilderBasedTemplate(com.intellij.platform.templates.BuilderBasedTemplate) FactoryMap(com.intellij.util.containers.FactoryMap) Set(java.util.Set) Icon(javax.swing.Icon) Collectors(java.util.stream.Collectors) WizardContext(com.intellij.ide.util.projectWizard.WizardContext) Nullable(org.jetbrains.annotations.Nullable) Dimension(java.awt.Dimension) List(java.util.List) Stream(java.util.stream.Stream) CoreUtil(com.liferay.ide.idea.util.CoreUtil) Function(com.intellij.util.Function) ModulesProvider(com.intellij.openapi.roots.ui.configuration.ModulesProvider) SettingsStep(com.intellij.ide.util.projectWizard.SettingsStep) ConfigurationException(com.intellij.openapi.options.ConfigurationException) NotNull(org.jetbrains.annotations.NotNull) JPanel(javax.swing.JPanel) ListSelectionModel(javax.swing.ListSelectionModel) CardLayout(java.awt.CardLayout) ProjectCategoryUsagesCollector(com.intellij.ide.projectWizard.ProjectCategoryUsagesCollector) JTextField(javax.swing.JTextField) ModuleBuilder(com.intellij.ide.util.projectWizard.ModuleBuilder) ContainerUtil(com.intellij.util.containers.ContainerUtil) ProjectTemplate(com.intellij.platform.ProjectTemplate) FrameworkSupportModelBase(com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) FrameworkSupportNode(com.intellij.ide.util.newProjectWizard.FrameworkSupportNode) LibrariesContainer(com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesContainer) TemplateModuleBuilder(com.intellij.platform.templates.TemplateModuleBuilder) ProjectCategory(com.intellij.ide.projectWizard.ProjectCategory) FrameworkSupportUtil(com.intellij.ide.util.frameworkSupport.FrameworkSupportUtil) Project(com.intellij.openapi.project.Project) ModuleType(com.intellij.openapi.module.ModuleType) StepSequence(com.intellij.ide.util.newProjectWizard.StepSequence) FrameworkRole(com.intellij.ide.util.frameworkSupport.FrameworkRole) JComponent(javax.swing.JComponent) JBList(com.intellij.ui.components.JBList) StringUtil(com.intellij.openapi.util.text.StringUtil) ListItemDescriptorAdapter(com.intellij.openapi.ui.popup.ListItemDescriptorAdapter) Convertor(com.intellij.util.containers.Convertor) FrameworkSupportNodeBase(com.intellij.ide.util.newProjectWizard.FrameworkSupportNodeBase) CollectionListModel(com.intellij.ui.CollectionListModel) ProjectTemplatesFactory(com.intellij.platform.ProjectTemplatesFactory) Disposable(com.intellij.openapi.Disposable) SingleSelectionModel(com.intellij.ui.SingleSelectionModel) FrameworkSupportInModuleProvider(com.intellij.framework.addSupport.FrameworkSupportInModuleProvider) AbstractMap(java.util.AbstractMap) IdeBorderFactory(com.intellij.ui.IdeBorderFactory) JLabel(javax.swing.JLabel) GroupedItemsListRenderer(com.intellij.ui.popup.list.GroupedItemsListRenderer) ConcurrentMultiMap(com.intellij.util.containers.ConcurrentMultiMap) ListSelectionListener(javax.swing.event.ListSelectionListener) Collections(java.util.Collections) ListSpeedSearch(com.intellij.ui.ListSpeedSearch) Set(java.util.Set) HashSet(java.util.HashSet) ProjectCategory(com.intellij.ide.projectWizard.ProjectCategory) ModuleBuilder(com.intellij.ide.util.projectWizard.ModuleBuilder) TemplateModuleBuilder(com.intellij.platform.templates.TemplateModuleBuilder) ArrayList(java.util.ArrayList) JLabel(javax.swing.JLabel) TemplatesGroup(com.intellij.ide.util.newProjectWizard.TemplatesGroup) Dimension(java.awt.Dimension) List(java.util.List) ArrayList(java.util.ArrayList) JBList(com.intellij.ui.components.JBList) Stream(java.util.stream.Stream) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) THashMap(gnu.trove.THashMap) Map(java.util.Map) MultiMap(com.intellij.util.containers.MultiMap) FactoryMap(com.intellij.util.containers.FactoryMap) AbstractMap(java.util.AbstractMap) ConcurrentMultiMap(com.intellij.util.containers.ConcurrentMultiMap) HashSet(java.util.HashSet)

Aggregations

FrameworkSupportInModuleProvider (com.intellij.framework.addSupport.FrameworkSupportInModuleProvider)1 ProjectCategory (com.intellij.ide.projectWizard.ProjectCategory)1 ProjectCategoryUsagesCollector (com.intellij.ide.projectWizard.ProjectCategoryUsagesCollector)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 FrameworkRole (com.intellij.ide.util.frameworkSupport.FrameworkRole)1 FrameworkSupportUtil (com.intellij.ide.util.frameworkSupport.FrameworkSupportUtil)1 AddSupportForFrameworksPanel (com.intellij.ide.util.newProjectWizard.AddSupportForFrameworksPanel)1 FrameworkSupportNode (com.intellij.ide.util.newProjectWizard.FrameworkSupportNode)1 FrameworkSupportNodeBase (com.intellij.ide.util.newProjectWizard.FrameworkSupportNodeBase)1 StepSequence (com.intellij.ide.util.newProjectWizard.StepSequence)1 TemplatesGroup (com.intellij.ide.util.newProjectWizard.TemplatesGroup)1 WizardDelegate (com.intellij.ide.util.newProjectWizard.WizardDelegate)1 FrameworkSupportModelBase (com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelBase)1 ModuleBuilder (com.intellij.ide.util.projectWizard.ModuleBuilder)1 ModuleWizardStep (com.intellij.ide.util.projectWizard.ModuleWizardStep)1 SettingsStep (com.intellij.ide.util.projectWizard.SettingsStep)1 WizardContext (com.intellij.ide.util.projectWizard.WizardContext)1 CommitStepException (com.intellij.ide.wizard.CommitStepException)1 Disposable (com.intellij.openapi.Disposable)1 Logger (com.intellij.openapi.diagnostic.Logger)1