JComponent () { if (myProject.isDefault()) { T configurable = createDefaultProjectConfigurable(); if (configurable != null) { var projectConfigurableProvider = AtomicNotNullLazyValue.createValue(() -> configurable); myConfigurablesProviders.put(null, projectConfigurableProvider); return projectConfigurableProvider.getValue().createComponent(); } } final List<Module> modules = ContainerUtil.filter(ModuleAttachProcessor.getSortedModules(myProject), module -> isSuitableForModule(module)); final T projectConfigurable = createProjectConfigurable(); if (modules.size() == 1 && projectConfigurable == null) { Module module = modules.get(0); var onlyModuleConfigurableProvider = AtomicNotNullLazyValue.createValue(() -> createModuleConfigurable(module)); myConfigurablesProviders.put(module, onlyModuleConfigurableProvider); return onlyModuleConfigurableProvider.getValue().createComponent(); } final Splitter splitter = new Splitter(false, 0.25f); CollectionListModel<Module> listDataModel = new CollectionListModel<>(modules); final JBList<Module> moduleList = new JBList<>(listDataModel); ListSpeedSearch.installOn(moduleList, o -> o == null ? getProjectConfigurableItemName() : o.getName()); moduleList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); moduleList.setCellRenderer(new ModuleListCellRenderer() { @Override public void customize(@NotNull JList<? extends Module> list, Module module, int index, boolean selected, boolean hasFocus) { if (module == null) { setText(getProjectConfigurableItemName()); setIcon(getProjectConfigurableItemIcon()); } else { super.customize(list, module, index, selected, hasFocus); } } }); splitter.setFirstComponent(new JBScrollPane(moduleList)); final CardLayout layout = new CardLayout(); final JPanel cardPanel = new JPanel(layout); splitter.setSecondComponent(cardPanel); if (projectConfigurable != null) { myConfigurablesProviders.put(null, AtomicNotNullLazyValue.createValue(() -> projectConfigurable)); final JComponent component = projectConfigurable.createComponent(); if (component != null) { cardPanel.add(component, PROJECT_ITEM_KEY); listDataModel.add(0, null); } } for (Module module : modules) { myConfigurablesProviders.put(module, AtomicNotNullLazyValue.createValue(() -> { final T configurable = createModuleConfigurable(module); JComponent component = configurable.createComponent(); if (component == null) { component = new JPanel(); } cardPanel.add(component, module.getName()); configurable.reset(); return configurable; })); } moduleList.addListSelectionListener(__ -> showModuleConfigurable(layout, cardPanel, moduleList.getSelectedValue())); if (moduleList.getItemsCount() > 0) { moduleList.setSelectedIndex(0); showModuleConfigurable(layout, cardPanel, listDataModel.getElementAt(0)); } return splitter; }