e.getPresentation().setEnabled(!recentMessages.isEmpty());
}
}
public void actionPerformed(AnActionEvent e) {
CheckinProjectPanel panel = (CheckinProjectPanel)e.getDataContext().getData(CheckinProjectPanel.PANEL);
if (panel != null) {
final Project project = panel.getProject();
final VcsConfiguration configuration = VcsConfiguration.getInstance(project);
final ArrayList<String> recentMessages = configuration.getRecentMessages();
Collections.reverse(recentMessages);
if (!recentMessages.isEmpty()) {
final ContentChooser<String> contentChooser = new ContentChooser<String>(project, VcsBundle.message("dialog.title.choose.commit.message.from.history"), false){
protected void removeContentAt(final String content) {
}
protected String getStringRepresentationFor(final String content) {
return content;
}
protected List<String> getContents() {
return recentMessages;
}
};
contentChooser.show();
if (contentChooser.isOK()) {
final int selectedIndex = contentChooser.getSelectedIndex();
if (selectedIndex >= 0) {
panel.setCommitMessage(contentChooser.getAllContents().get(selectedIndex));
}
}
}
}