ListSelection<ShelvedWrapper> (@NotNull DataContext dataContext) { ChangesTree tree = dataContext.getData(SHELVED_CHANGES_TREE); if (tree == null) return ListSelection.empty(); ListSelection<ShelvedWrapper> wrappers = ListSelection.createAt(VcsTreeModelData.selected(tree).userObjects(ShelvedWrapper.class), 0); if (wrappers.getList().size() == 1) { // return all changes for selected changelist ShelvedChangeList changeList = getFirstItem(getSelectedLists(tree, it -> true)); if (changeList != null) { ChangesBrowserNode<?> changeListNode = (ChangesBrowserNode<?>)TreeUtil.findNodeWithObject(tree.getRoot(), changeList); if (changeListNode != null) { List<ShelvedWrapper> allWrappers = changeListNode.getAllObjectsUnder(ShelvedWrapper.class); if (allWrappers.size() > 1) { ShelvedWrapper toSelect = getFirstItem(wrappers.getList()); return ListSelection.create(allWrappers, toSelect); } } } } return wrappers.asExplicitSelection(); }