JComponent (final Project project, final TemplatesManager templatesManager, final @Nls String templatesTitle) { final JPanel panel = new JPanel(new BorderLayout()); final JLabel templateChooserLabel = new JLabel(templatesTitle); panel.add(templateChooserLabel, BorderLayout.WEST); final ComboBox<TemplateResource> comboBox = new ComboBox<>(); templateChooserLabel.setLabelFor(comboBox); comboBox.setRenderer(SimpleListCellRenderer.create("", TemplateResource::getName)); final ComponentWithBrowseButton<ComboBox<?>> comboBoxWithBrowseButton = new ComponentWithBrowseButton<>(comboBox, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final TemplatesPanel ui = new TemplatesPanel(project, templatesManager) { @Override protected boolean onMultipleFields() { return false; } @Nls @Override public String getDisplayName() { return StringUtil.capitalizeWords(UIUtil.removeMnemonic(StringUtil.trimEnd(templatesTitle, ":")), true); } }; ui.setHint(JavaBundle.message("generate.getter.setter.header.visibility.hint.")); ui.selectNodeInTree(templatesManager.getDefaultTemplate()); if (ShowSettingsUtil.getInstance().editConfigurable(panel, ui)) { setComboboxModel(templatesManager, comboBox); } } }); setComboboxModel(templatesManager, comboBox); comboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(@NotNull final ActionEvent M) { templatesManager.setDefaultTemplate((TemplateResource)comboBox.getSelectedItem()); } }); panel.add(comboBoxWithBrowseButton, BorderLayout.CENTER); return panel; }