void (TemplatesManager templatesManager, ComboBox<TemplateResource> comboBox) { final Collection<TemplateResource> templates = templatesManager.getAllTemplates(); comboBox.setModel(new DefaultComboBoxModel<>(templates.toArray(new TemplateResource[0]))); comboBox.setSelectedItem(templatesManager.getDefaultTemplate()); }