[vcs-log] minor: Selection explicitly depends on VcsLogGraphTable and therefore can be static

This commit is contained in:
Julia Beliaeva
2015-02-24 15:28:39 +03:00
parent 4fa0df5db3
commit 259930857a
@@ -399,23 +399,25 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
@NotNull
public Selection getSelection() {
return new Selection();
return new Selection(this);
}
public class Selection {
public static class Selection {
private final TIntHashSet myCommits;
private final VcsLogGraphTable myTable;
public Selection() {
myCommits = getCommitsAtRows(myDataPack.getVisibleGraph(), getSelectedRows());
public Selection(@NotNull VcsLogGraphTable table) {
myTable = table;
myCommits = getCommitsAtRows(myTable.myDataPack.getVisibleGraph(), myTable.getSelectedRows());
}
public void restore(@NotNull VisibleGraph<Integer> newVisibleGraph) {
TIntHashSet rowsToSelect = findNewRowsToSelect(getGraphTableModel(), newVisibleGraph, myCommits);
TIntHashSet rowsToSelect = findNewRowsToSelect(myTable.getGraphTableModel(), newVisibleGraph, myCommits);
if (!rowsToSelect.isEmpty()) {
rowsToSelect.forEach(new TIntProcedure() {
@Override
public boolean execute(int row) {
addRowSelectionInterval(row, row);
myTable.addRowSelectionInterval(row, row);
return true;
}
});