Example #1
0
        static void UpdateReportListViewItemCellGUI(
            Rect rect,
            string wkPath,
            UpdateReportLineListViewItem item,
            ErrorsListColumn column,
            float rowHeight,
            bool isSelected,
            bool isFocused,
            int totalLinesCount,
            Action onCheckedReportLineChanged,
            HashSet <UpdateReportLineListViewItem> checkedLines)
        {
            string label = WorkspacePath.GetWorkspaceRelativePath(
                wkPath,
                item.ReportLine.ItemPath);

            bool wasChecked = checkedLines.Contains(item);
            bool isChecked  = DrawTreeViewItem.ForCheckableItemCell(
                rect,
                rowHeight,
                0,
                null,
                null,
                label,
                isSelected,
                isFocused,
                false,
                wasChecked);

            if (wasChecked != isChecked)
            {
                UpdateCheckedState(checkedLines, item, isChecked);
                onCheckedReportLineChanged();
            }
        }
Example #2
0
        internal SelectedChangesGroupInfo GetSelectedChangesGroupInfo()
        {
            SelectedChangesGroupInfo result = new SelectedChangesGroupInfo();

            IList <int> selectedIds = GetSelection();

            if (selectedIds.Count == 0)
            {
                return(result);
            }

            foreach (KeyValuePair <PendingChangeInfo, int> item
                     in mTreeViewItemIds.GetInfoItems())
            {
                if (!selectedIds.Contains(item.Value))
                {
                    continue;
                }

                ChangeInfo changeInfo = item.Key.ChangeInfo;

                result.SelectedCount++;
                result.IsAnyDirectorySelected   |= changeInfo.IsDirectory;
                result.IsAnyPrivateSelected     |= !ChangeInfoType.IsControlled(changeInfo);
                result.IsAnyControlledSelected  |= ChangeInfoType.IsControlled(changeInfo);
                result.IsAnyLocalChangeSelected |= ChangeInfoType.IsLocalChange(changeInfo);

                result.FilterInfo.IsAnyIgnoredSelected       |= ChangeInfoType.IsIgnored(changeInfo);
                result.FilterInfo.IsAnyHiddenChangedSelected |= ChangeInfoType.IsHiddenChanged(changeInfo);

                string wkRelativePath = InternalNames.RootDir +
                                        WorkspacePath.GetWorkspaceRelativePath(
                    mWkInfo.ClientPath, changeInfo.GetFullPath());

                if (result.SelectedCount == 1)
                {
                    result.FilterInfo.CommonName      = Path.GetFileName(changeInfo.GetFullPath());
                    result.FilterInfo.CommonExtension = changeInfo.GetExtension();
                    result.FilterInfo.CommonFullPath  = wkRelativePath;
                    continue;
                }

                if (result.FilterInfo.CommonName != Path.GetFileName(changeInfo.GetFullPath()))
                {
                    result.FilterInfo.CommonName = null;
                }

                if (result.FilterInfo.CommonExtension != changeInfo.GetExtension())
                {
                    result.FilterInfo.CommonExtension = null;
                }

                if (result.FilterInfo.CommonFullPath != wkRelativePath)
                {
                    result.FilterInfo.CommonFullPath = null;
                }
            }

            return(result);
        }
Example #3
0
        void DoFileList(
            WorkspaceInfo wkInfo,
            List <string> paths,
            IAssetStatusCache assetStatusCache,
            MetaCache metaCache)
        {
            mFileListScrollPosition = GUILayout.BeginScrollView(
                mFileListScrollPosition,
                EditorStyles.helpBox,
                GUILayout.ExpandHeight(true));

            foreach (string path in paths)
            {
                if (MetaPath.IsMetaPath(path))
                {
                    continue;
                }

                Texture fileIcon = Directory.Exists(path) ?
                                   Images.GetDirectoryIcon() :
                                   Images.GetFileIcon(path);

                string label = WorkspacePath.GetWorkspaceRelativePath(
                    wkInfo.ClientPath, path);

                if (metaCache.HasMeta(path))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                GUIContent content = new GUIContent(
                    label, fileIcon);

                GUILayout.Label(
                    content,
                    GUILayout.Height(UnityConstants.TREEVIEW_ROW_HEIGHT));

                Rect iconRect = GUILayoutUtility.GetLastRect();

                DoStatusOverlays(
                    iconRect,
                    assetStatusCache,
                    path);
            }

            GUILayout.EndScrollView();
        }
Example #4
0
        void DoFileList(
            WorkspaceInfo wkInfo,
            List <string> paths,
            IAssetStatusCache assetStatusCache,
            MetaCache metaCache)
        {
            mFileListScrollPosition = GUILayout.BeginScrollView(
                mFileListScrollPosition,
                EditorStyles.helpBox,
                GUILayout.ExpandHeight(true));

            foreach (string path in paths)
            {
                if (MetaPath.IsMetaPath(path))
                {
                    continue;
                }

                Texture fileIcon = Directory.Exists(path) ?
                                   Images.GetDirectoryIcon() :
                                   Images.GetFileIcon(path);

                string label = WorkspacePath.GetWorkspaceRelativePath(
                    wkInfo.ClientPath, path);

                if (metaCache.HasMeta(path))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                AssetsOverlays.AssetStatus assetStatus =
                    assetStatusCache.GetStatusForPath(path);

                Rect selectionRect = EditorGUILayout.GetControlRect();

                DoListViewItem(selectionRect, fileIcon, label, assetStatus);
            }

            GUILayout.EndScrollView();
        }