diff: do not hide focused viewer if there are no more changes in a tree

This commit is contained in:
Aleksey Pivovarov
2018-04-18 14:44:15 +03:00
parent 8fb8436351
commit c688ac6cb4
@@ -143,21 +143,25 @@ public abstract class ChangeViewDiffRequestProcessor extends CacheDiffRequestPro
public void refresh() {
List<Wrapper> selectedChanges = getSelectedChanges();
Wrapper selectedChange = myCurrentChange != null ? ContainerUtil.find(selectedChanges, myCurrentChange) : null;
if (selectedChange == null &&
myCurrentChange != null &&
getContext().isWindowFocused() &&
getContext().isFocusedInWindow()) {
// Do not automatically switch focused viewer
if (selectedChanges.size() == 1 && getAllChanges().contains(myCurrentChange)) {
selectChange(myCurrentChange); // Restore selection if necessary
}
return;
}
if (selectedChanges.isEmpty()) {
myCurrentChange = null;
updateRequest();
return;
}
Wrapper selectedChange = myCurrentChange != null ? ContainerUtil.find(selectedChanges, myCurrentChange) : null;
if (selectedChange == null) {
if (myCurrentChange != null && getContext().isWindowFocused() && getContext().isFocusedInWindow()) { // Do not automatically switch file if focused
if (selectedChanges.size() == 1 && getAllChanges().contains(myCurrentChange)) {
selectChange(myCurrentChange); // Restore selection if necessary
}
return;
}
myCurrentChange = selectedChanges.get(0);
updateRequest();
return;