static void RegenerateRows( UnityPendingChangesTree pendingChangesTree, TreeViewItemIds <PendingChangeCategory, PendingChangeInfo> treeViewItemIds, PendingChangesTreeView treeView, TreeViewItem rootItem, List <TreeViewItem> rows, bool expandCategories) { ClearRows(rootItem, rows); List <PendingChangeCategory> categories = pendingChangesTree.GetNodes(); if (categories == null) { return; } foreach (PendingChangeCategory category in categories) { int categoryId; if (!treeViewItemIds.TryGetCategoryItemId(category, out categoryId)) { categoryId = treeViewItemIds.AddCategoryItem(category); } ChangeCategoryTreeViewItem categoryTreeViewItem = new ChangeCategoryTreeViewItem(categoryId, category); rootItem.AddChild(categoryTreeViewItem); rows.Add(categoryTreeViewItem); if (!expandCategories && !treeView.IsExpanded(categoryTreeViewItem.id)) { continue; } foreach (PendingChangeInfo change in category.GetCurrentChanges()) { int changeId; if (!treeViewItemIds.TryGetInfoItemId(change, out changeId)) { changeId = treeViewItemIds.AddInfoItem(change); } TreeViewItem changeTreeViewItem = new ChangeTreeViewItem(changeId, change); categoryTreeViewItem.AddChild(changeTreeViewItem); rows.Add(changeTreeViewItem); } } if (!expandCategories) { return; } treeView.state.expandedIDs = treeViewItemIds.GetCategoryIds(); }
static void RegenerateRows( UnityDiffTree diffTree, TreeViewItemIds <IDiffCategory, ITreeViewNode> treeViewItemIds, TreeView treeView, TreeViewItem rootItem, List <TreeViewItem> rows, bool expandCategories) { ClearRows(rootItem, rows); List <IDiffCategory> categories = diffTree.GetNodes(); if (categories == null) { return; } foreach (IDiffCategory category in categories) { if (category is MergeCategory) { AddMergeCategory( rootItem, category, rows, treeViewItemIds, treeView, expandCategories); } if (category is ChangeCategory) { AddChangeCategory( rootItem, category, rows, treeViewItemIds, treeView, expandCategories); } } if (!expandCategories) { return; } treeView.state.expandedIDs = treeViewItemIds.GetCategoryIds(); }