ComboBox<String> (@NotNull Project project, @NotNull ComboBox<String> comboBox, @NotNull Consumer<? super String> messageConsumer) { List<String> messages = VcsConfiguration.getInstance(project).getRecentMessages(); Collections.reverse(messages); CollectionComboBoxModel<String> model = new CollectionComboBoxModel<>(messages); comboBox.setModel(model); comboBox.setRenderer(SimpleListCellRenderer.create("", commitMessage -> getPresentableCommitMessage(commitMessage))); comboBox.addActionListener(e -> messageConsumer.accept(model.getSelected())); return comboBox; }