baseComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Object o = baseComboBox.getSelectedItem();
if (o instanceof ConversationID) {
ConversationID id = (ConversationID) o;
ConversationModel cModel = _model.getConversationModel();
Response response = cModel.getResponse(id);
String cType = response.getHeader("Content-Type");
if (cType == null || !cType.startsWith("text")) {
JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation is not text", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
byte[] content = response.getContent();
if (content == null || content.length == 0) {
JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation has no content", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
_compare.setBaseConversation(null, id);
_base = new String(content);
}
}
});
conversationTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
int selected = conversationTable.getSelectedRow();
_diffPanel.clear();
if (selected == -1) {
return;
}
selected = _conversationSorter.modelIndex(selected);
ConversationModel cmodel = _model.getComparisonModel();
ConversationID id = cmodel.getConversationAt(selected);
Response response = cmodel.getResponse(id);
String contentType = response.getHeader("Content-Type");
if (contentType == null || !contentType.startsWith("text")) {
JOptionPane.showMessageDialog(ComparePanel.this, "Selected conversation is not text", "Error", JOptionPane.ERROR_MESSAGE);
return;