public void restore(@NotNull VisibleGraph<Integer> newVisibleGraph, boolean scrollToSelection) { Pair<TIntHashSet, Integer> toSelectAndScroll = findRowsToSelectAndScroll(myTable.getGraphTableModel(), newVisibleGraph); if (!toSelectAndScroll.first.isEmpty()) { myTable.getSelectionModel().setValueIsAdjusting(true); toSelectAndScroll.first.forEach( new TIntProcedure() { @Override public boolean execute(int row) { myTable.addRowSelectionInterval(row, row); return true; } }); myTable.getSelectionModel().setValueIsAdjusting(false); } if (scrollToSelection) { if (myScrollToTop) { scrollToRow(0, 0); } else if (toSelectAndScroll.second != null) { assert myDelta != null; scrollToRow(toSelectAndScroll.second, myDelta); } } // sometimes commits that were selected are now collapsed // currently in this case selection disappears // in the future we need to create a method in LinearGraphController that allows to calculate // visible commit for our commit // or answer from collapse action could return a map that gives us some information about what // commits were collapsed and where }