Ejemplo n.º 1
0
        void UpdateFileConflictsTree(
            IncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView incomingChangesTreeView)
        {
            UnityIncomingChangesTree unityIncomingChangesTree = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                unityIncomingChangesTree = UnityIncomingChangesTree.BuildIncomingChangeCategories(
                    incomingChangesTree);
                incomingChangesTree.ResolveUserNames(
                    new IncomingChangesTree.ResolveUserName());
            },
                /*afterOperationDelegate*/ delegate
            {
                incomingChangesTreeView.BuildModel(unityIncomingChangesTree);
                incomingChangesTreeView.Sort();
                incomingChangesTreeView.Reload();

                incomingChangesTreeView.SelectFirstUnsolvedDirectoryConflict();
            });
        }
Ejemplo n.º 2
0
        static bool ShouldExpandCategory(
            IncomingChangesTreeView treeView,
            ChangeCategoryTreeViewItem categoryTreeViewItem,
            bool expandCategories,
            int categoriesCount)
        {
            if (expandCategories)
            {
                if (categoriesCount == 1)
                {
                    return(true);
                }

                if (categoryTreeViewItem.Category.CategoryType ==
                    IncomingChangesCategory.Type.FileConflicts)
                {
                    return(true);
                }

                if (categoryTreeViewItem.Category.GetChangesCount() >
                    NODES_TO_EXPAND_CATEGORY)
                {
                    return(false);
                }

                return(true);
            }

            return(treeView.IsExpanded(categoryTreeViewItem.id));
        }
Ejemplo n.º 3
0
        static void IncomingChangeTreeViewItemGUI(
            string wkPath,
            UnityIncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView treeView,
            ChangeTreeViewItem item,
            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,
                    column,
                    args.selected,
                    args.focused,
                    isCurrentConflict,
                    isSolvedConflict);
            }
        }
Ejemplo n.º 4
0
        internal static SelectedIncomingChangesGroupInfo GetSelectedGroupInfo(
            IncomingChangesTreeView treeView)
        {
            List <IncomingChangeInfo> selectedIncomingChanges =
                treeView.GetSelectedIncomingChanges();

            return(GetSelectedIncomingChangesGroupInfo.For(
                       selectedIncomingChanges));
        }
Ejemplo n.º 5
0
        static void IncomingChangeTreeViewItemCellGUI(
            string wkPath,
            Rect rect,
            float rowHeight,
            UnityIncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView treeView,
            ChangeTreeViewItem item,
            IncomingChangesTreeColumn column,
            bool isSelected,
            bool isFocused,
            bool isCurrentConflict,
            bool isSolvedConflict)
        {
            IncomingChangeInfo incomingChange = item.ChangeInfo;

            string label = incomingChange.GetColumnText(
                IncomingChangesTreeHeaderState.GetColumnName(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);

                DrawTreeViewItem.ForItemCell(
                    rect,
                    rowHeight,
                    item.depth,
                    icon,
                    overlayIconData,
                    label,
                    isSelected,
                    isFocused,
                    isCurrentConflict);

                return;
            }

            if (column == IncomingChangesTreeColumn.Size)
            {
                DefaultGUI.LabelRightAligned(rect, label, isSelected, isFocused);
                return;
            }

            DefaultGUI.Label(rect, label, isSelected, isFocused);
        }
Ejemplo n.º 6
0
        static void DoConflictsTree(
            IncomingChangesTreeView incomingChangesTreeView,
            bool isOperationRunning)
        {
            GUI.enabled = !isOperationRunning;

            Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);

            incomingChangesTreeView.OnGUI(rect);

            GUI.enabled = true;
        }
Ejemplo n.º 7
0
        void BuildComponents(WorkspaceInfo wkInfo)
        {
            IncomingChangesTreeHeaderState incomingChangesHeaderState =
                IncomingChangesTreeHeaderState.Default;

            TreeHeaderSettings.Load(incomingChangesHeaderState,
                                    UnityConstants.DEVELOPER_INCOMING_CHANGES_TABLE_SETTINGS_NAME,
                                    (int)IncomingChangesTreeColumn.Path, true);

            mIncomingChangesTreeView = new IncomingChangesTreeView(
                wkInfo, incomingChangesHeaderState,
                new IncomingChangesViewMenu(this, this));
            mIncomingChangesTreeView.Reload();
        }
Ejemplo n.º 8
0
        static void DoFileConflictsArea(
            PlasticGUIClient plasticClient,
            IncomingChangesTreeView incomingChangesTreeView,
            MergeTreeResult conflicts,
            MergeSolvedFileConflicts solvedConflicts,
            MountPointWithPath mount,
            bool isOperationRunning)
        {
            DoConflictsHeader(
                conflicts,
                solvedConflicts,
                mount);

            DoConflictsTree(
                incomingChangesTreeView,
                isOperationRunning);
        }
Ejemplo n.º 9
0
        internal static List <string> GetPathsFromSelectedFileConflictsIncludingMeta(
            IncomingChangesTreeView treeView)
        {
            List <string> result = new List <string>();

            List <IncomingChangeInfo> selection =
                treeView.GetSelectedFileConflicts();

            treeView.FillWithMeta(selection);

            foreach (IncomingChangeInfo incomingChange in selection)
            {
                result.Add(incomingChange.GetPath());
            }

            return(result);
        }
Ejemplo n.º 10
0
        static void RegenerateRows(
            UnityIncomingChangesTree incomingChangesTree,
            TreeViewItemIds <IncomingChangesCategory, IncomingChangeInfo> treeViewItemIds,
            IncomingChangesTreeView treeView,
            TreeViewItem rootItem,
            List <TreeViewItem> rows,
            bool expandCategories)
        {
            if (incomingChangesTree == null)
            {
                return;
            }

            ClearRows(rootItem, rows);

            List <IncomingChangesCategory> categories = incomingChangesTree.GetNodes();

            if (categories == null)
            {
                return;
            }

            List <int> categoriesToExpand = new List <int>();

            foreach (IncomingChangesCategory 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,
                        expandCategories,
                        categories.Count))
                {
                    continue;
                }

                categoriesToExpand.Add(categoryTreeViewItem.id);

                foreach (IncomingChangeInfo changeInfo in category.GetChanges())
                {
                    int differenceId;
                    if (!treeViewItemIds.TryGetInfoItemId(changeInfo, out differenceId))
                    {
                        differenceId = treeViewItemIds.AddInfoItem(changeInfo);
                    }

                    TreeViewItem changeTreeViewItem =
                        new ChangeTreeViewItem(differenceId, changeInfo);

                    categoryTreeViewItem.AddChild(changeTreeViewItem);
                    rows.Add(changeTreeViewItem);
                }
            }

            treeView.state.expandedIDs = categoriesToExpand;
        }
Ejemplo n.º 11
0
 internal static IncomingChangeInfo GetSingleSelectedIncomingChange(
     IncomingChangesTreeView treeView)
 {
     return(treeView.GetSelectedIncomingChange());
 }