# HG changeset patch # User dirk # Date 1316338100 -7200 # Node ID 0bed77e3608ee576a6834981b527297bff6308db # Parent d7f357434800ce586c7a7d41b689fd53fc1288c6 fix a bug with selection in the differences table diff -r d7f357434800 -r 0bed77e3608e conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditor.java --- 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); diff -r d7f357434800 -r 0bed77e3608e conflict-editor/src/main/java/de/codedo/conflicteditor/gui/ConflictEditorFrame.java --- 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);