void (boolean fromModelRefresh) { if (isDisposed()) return; List<? extends Wrapper> selectedChanges = ContainerUtil.newArrayList(iterateSelectedChanges()); if (selectedChanges.isEmpty() && showAllChangesForEmptySelection()) selectedChanges = ContainerUtil.newArrayList(iterateAllChanges()); Wrapper selectedChange = myCurrentChange != null ? ContainerUtil.find(selectedChanges, myCurrentChange) : null; if (fromModelRefresh && selectedChange == null && myCurrentChange != null && getContext().isWindowFocused() && getContext().isFocusedInWindow()) { // Do not automatically switch focused viewer if (selectedChanges.size() == 1 && ContainerUtil.exists(iterateAllChanges(), it -> myCurrentChange.equals(it))) { selectChange(myCurrentChange); // Restore selection if necessary } return; } if (selectedChanges.isEmpty()) { setCurrentChange(null); return; } if (selectedChange == null) { setCurrentChange(selectedChanges.get(0)); return; } setCurrentChange(selectedChange); }