static void IncomingChangeTreeViewItemGUI( string wkPath, UnityIncomingChangesTree incomingChangesTree, IncomingChangesTreeView treeView, ChangeTreeViewItem item, Action onCheckedNodeChanged, RowGUIArgs args, bool isCurrentConflict, bool isSolvedConflict) { for (int visibleColumnIdx = 0; visibleColumnIdx < args.GetNumVisibleColumns(); visibleColumnIdx++) { Rect cellRect = args.GetCellRect(visibleColumnIdx); IncomingChangesTreeColumn column = (IncomingChangesTreeColumn)args.GetColumn(visibleColumnIdx); IncomingChangeTreeViewItemCellGUI( wkPath, cellRect, treeView.rowHeight, incomingChangesTree, treeView, item, onCheckedNodeChanged, column, args.selected, args.focused, isCurrentConflict, isSolvedConflict); } }
static void UpdateIncomingChangesTree( IncomingChangesTreeView incomingChangesTreeView, IncomingChangesTree tree) { incomingChangesTreeView.BuildModel( UnityIncomingChangesTree.BuildIncomingChangeCategories(tree)); incomingChangesTreeView.Sort(); incomingChangesTreeView.Reload(); }
static void IncomingChangeTreeViewItemCellGUI( string wkPath, Rect rect, float rowHeight, UnityIncomingChangesTree incomingChangesTree, IncomingChangesTreeView treeView, ChangeTreeViewItem item, Action onCheckedNodeChanged, IncomingChangesTreeColumn column, bool isSelected, bool isFocused, bool isCurrentConflict, bool isSolvedConflict) { IncomingChangeInfo incomingChange = item.ChangeInfo; string label = incomingChange.GetColumnText( IncomingChangesTreeHeaderState.GetHeaderContent(column)); if (column == IncomingChangesTreeColumn.Path) { if (incomingChangesTree.HasMeta(item.ChangeInfo)) { label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL); } Texture icon = GetIcon(wkPath, incomingChange); GetOverlayIcon.Data overlayIconData = GetOverlayData( incomingChange, isSolvedConflict); bool wasChecked = incomingChange.IsChecked(); bool isChecked = DrawTreeViewItem.ForCheckableItemCell( rect, rowHeight, item.depth, icon, overlayIconData, label, isSelected, isFocused, isCurrentConflict, wasChecked); incomingChange.UpdateCheckedState(isChecked); if (wasChecked != isChecked) { UpdateCheckStateForSelection(treeView, item); onCheckedNodeChanged(); } return; } if (column == IncomingChangesTreeColumn.Size) { DefaultGUI.LabelRightAligned(rect, label, isSelected, isFocused); return; } DefaultGUI.Label(rect, label, isSelected, isFocused); }
internal void BuildModel(UnityIncomingChangesTree tree) { mTreeViewItemIds.Clear(); mIncomingChangesTree = tree; mSolvedConflicts = new List <IncomingChangeInfo>(); mCurrentConflict = null; mExpandCategories = true; }
static void RegenerateRows( UnityIncomingChangesTree incomingChangesTree, TreeViewItemIds <IncomingChangeCategory, IncomingChangeInfo> treeViewItemIds, IncomingChangesTreeView treeView, TreeViewItem rootItem, List <TreeViewItem> rows, bool expandCategories) { if (incomingChangesTree == null) { return; } ClearRows(rootItem, rows); List <IncomingChangeCategory> categories = incomingChangesTree.GetNodes(); if (categories == null) { return; } List <int> categoriesToExpand = new List <int>(); foreach (IncomingChangeCategory 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 (!ShouldExpandCategory( treeView, categoryTreeViewItem, categories.Count, expandCategories)) { continue; } categoriesToExpand.Add(categoryTreeViewItem.id); foreach (IncomingChangeInfo incomingChange in category.GetChanges()) { int changeId; if (!treeViewItemIds.TryGetInfoItemId(incomingChange, out changeId)) { changeId = treeViewItemIds.AddInfoItem(incomingChange); } TreeViewItem changeTreeViewItem = new ChangeTreeViewItem(changeId, incomingChange); categoryTreeViewItem.AddChild(changeTreeViewItem); rows.Add(changeTreeViewItem); } } treeView.state.expandedIDs = categoriesToExpand; }