Mercurial > hg > ConflictEditor
changeset 28:0bed77e3608e
fix a bug with selection in the differences table
author | dirk |
---|---|
date | Sun, 18 Sep 2011 11:28:20 +0200 |
parents | d7f357434800 |
children | fc8f3ac948df |
files | conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditor.java conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java |
diffstat | 2 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditor.java Sun Sep 18 11:27:55 2011 +0200 +++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditor.java Sun Sep 18 11:28:20 2011 +0200 @@ -163,6 +163,9 @@ protected void selectDifference(int index) { + // the index that's passed in from the list selection event is wrong! + index = _frame.getDifferencesTable().getSelectedRow(); + DifferenceTableModel model = (DifferenceTableModel)_frame.getDifferencesTable().getModel(); Difference difference = model.differenceAtIndex(index); _controller.setCurrentDifference(difference);
--- a/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java Sun Sep 18 11:27:55 2011 +0200 +++ b/conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java Sun Sep 18 11:28:20 2011 +0200 @@ -15,6 +15,7 @@ import javax.swing.JSplitPane; import javax.swing.JTable; import javax.swing.JTextField; +import javax.swing.ListSelectionModel; import javax.swing.table.TableModel; public class ConflictEditorFrame extends JFrame @@ -115,6 +116,7 @@ { _differencesTable = new JTable(); _differencesTable.setDefaultRenderer(Object.class, new SpecialCharactersTableCellRenderer()); + _differencesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); TableModel model = new DifferenceTableModel(); _differencesTable.setModel(model);