TreeModel (List<? extends CommittedChangeList> filteredChangeLists) { DefaultMutableTreeNode root = new DefaultMutableTreeNode(); DefaultTreeModel model = new DefaultTreeModel(root); filteredChangeLists = ContainerUtil.sorted(filteredChangeLists, myGroupingStrategy.getComparator()); myGroupingStrategy.beforeStart(); DefaultMutableTreeNode lastGroupNode = null; @Nls String lastGroupName = null; for(CommittedChangeList list : filteredChangeLists) { String groupName = StringUtil.notNullize(myGroupingStrategy.getGroupName(list)); if (!Objects.equals(groupName, lastGroupName)) { lastGroupName = groupName; lastGroupNode = new DefaultMutableTreeNode(lastGroupName); root.add(lastGroupNode); } lastGroupNode.add(new DefaultMutableTreeNode(list)); } return model; }