[vcs] Preselect nothing in ChangesTreeList by default

On Show Diff, the ChangesTreeList limits files shown in diff to the
selected folder.

Thus if the first row is preselected (as it were before), and commit
changes files in different folders, automatic Show Diff from the log
table doesn't show everything, but only files from the first root
node which is confusing.

=> if there is nothing to select by default, don't select the first row.
This commit is contained in:
Kirill Likhodedov
2014-09-18 19:57:30 +04:00
parent 31ef51d3b0
commit e770f02eb7
@@ -364,7 +364,7 @@ public abstract class ChangesTreeList<T> extends JPanel implements TypeSafeDataP
TreeUtil.expandAll(myTree);
int listSelection = 0;
int scrollRow = 0;
int scrollRow = -1;
if (myShowCheckboxes) {
if (myIncludedChanges.size() > 0) {
@@ -421,7 +421,7 @@ public abstract class ChangesTreeList<T> extends JPanel implements TypeSafeDataP
return rowToSelect[0] == -1;
}
});
scrollRow = rowToSelect[0] == -1 ? scrollRow : rowToSelect[0];
}
}
@@ -430,7 +430,9 @@ public abstract class ChangesTreeList<T> extends JPanel implements TypeSafeDataP
myList.setSelectedIndex(listSelection);
myList.ensureIndexIsVisible(listSelection);
myTree.setSelectionRow(scrollRow);
if (scrollRow >= 0) {
myTree.setSelectionRow(scrollRow);
}
TreeUtil.showRowCentered(myTree, scrollRow, false);
}
}