ListSelection<Producer> (@NotNull Project project, @NotNull List<? extends Change> changes, @NotNull List<? extends FilePath> unversioned, @NotNull ChangesListView changesView) { if (changes.size() == 1 && unversioned.isEmpty()) { // show all changes from this changelist Change selectedChange = changes.get(0); List<Change> selectedChanges = changesView.getAllChangesFromSameChangelist(selectedChange); if (selectedChanges == null) { selectedChanges = changesView.getAllChangesFromSameAmendNode(selectedChange); } if (selectedChanges != null) { int selectedIndex = ContainerUtil.indexOf(selectedChanges, it -> ChangeListChange.HASHING_STRATEGY.equals(selectedChange, it)); if (selectedIndex == -1) selectedIndex = selectedChanges.indexOf(selectedChange); return createChangeProducers(project, selectedChanges, selectedIndex); } } if (unversioned.size() == 1 && changes.isEmpty()) { // show all unversioned changes FilePath selectedFile = unversioned.get(0); List<FilePath> allUnversioned = changesView.getUnversionedFiles().toList(); int selectedIndex = allUnversioned.indexOf(selectedFile); return createUnversionedProducers(project, allUnversioned, selectedIndex); } ListSelection<Producer> changeProducers = createChangeProducers(project, changes, 0); ListSelection<Producer> unversionedProducers = createUnversionedProducers(project, unversioned, 0); return ListSelection.createAt(ContainerUtil.concat(changeProducers.getList(), unversionedProducers.getList()), 0) .asExplicitSelection(); }