Ejemplo n.º 1
0
        static void DoHeader(
            WorkspaceInfo workspaceInfo,
            PlasticGUIClient plasticClient,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonSwitcher,
            bool isGluonMode,
            IIncomingChangesNotificationPanel incomingChangesNotificationPanel)
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);

            GUILayout.Label(
                plasticClient.HeaderTitle,
                UnityStyles.PlasticWindow.HeaderTitleLabel);

            GUILayout.FlexibleSpace();

            DrawIncomingChangesNotificationPanel.ForMode(
                workspaceInfo, plasticClient,
                mergeViewLauncher, gluonSwitcher, isGluonMode,
                incomingChangesNotificationPanel.IsVisible,
                incomingChangesNotificationPanel.Data);

            //TODO: Codice - beta: hide the switcher until the update dialog is implemented
            //DrawGuiModeSwitcher.ForMode(
            //    isGluonMode, plasticClient, changesTreeView, editorWindow);

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 2
0
        static void DoChangesArea(
            WorkspaceInfo wkInfo,
            PendingChangesTreeView changesTreeView,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher,
            bool isOperationRunning,
            bool isGluonMode,
            bool isCheckedInSuccessful,
            PlasticNotification.Status notificationStatus,
            string notificationInfoText,
            string notificationActionText)
        {
            GUI.enabled = !isOperationRunning;

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

            changesTreeView.OnGUI(rect);

            if (changesTreeView.GetTotalItemCount() == 0)
            {
                DrawEmptyState(
                    rect,
                    isCheckedInSuccessful,
                    notificationStatus,
                    notificationInfoText,
                    notificationActionText,
                    () => OpenIncomingChangesTab(
                        wkInfo,
                        mergeViewLauncher,
                        gluonViewSwitcher,
                        isGluonMode));
            }

            GUI.enabled = true;
        }
        internal static bool CheckinPaths(
            WorkspaceInfo wkInfo,
            List<string> paths,
            IAssetStatusCache assetStatusCache,
            bool isGluonMode,
            EditorWindow parentWindow,
            IWorkspaceWindow workspaceWindow,
            ViewHost viewHost,
            GuiMessage.IGuiMessage guiMessage,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher)
        {
            MetaCache metaCache = new MetaCache();
            metaCache.Build(paths);

            CheckinDialog dialog = Create(
                wkInfo,
                paths,
                assetStatusCache,
                metaCache,
                isGluonMode,
                new ProgressControlsForDialogs(),
                workspaceWindow,
                viewHost,
                guiMessage,
                mergeViewLauncher,
                gluonViewSwitcher);

            return dialog.RunModal(parentWindow) == ResponseType.Ok;
        }
Ejemplo n.º 4
0
        internal AssetOperations(
            WorkspaceInfo wkInfo,
            IWorkspaceWindow workspaceWindow,
            IViewSwitcher viewSwitcher,
            IHistoryViewLauncher historyViewLauncher,
            ViewHost viewHost,
            NewIncomingChangesUpdater newIncomingChangesUpdater,
            IAssetStatusCache assetStatusCache,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher,
            EditorWindow parentWindow,
            IAssetSelection assetSelection,
            bool isGluonMode)
        {
            mWkInfo                    = wkInfo;
            mWorkspaceWindow           = workspaceWindow;
            mViewSwitcher              = viewSwitcher;
            mHistoryViewLauncher       = historyViewLauncher;
            mViewHost                  = viewHost;
            mNewIncomingChangesUpdater = newIncomingChangesUpdater;
            mAssetStatusCache          = assetStatusCache;
            mMergeViewLauncher         = mergeViewLauncher;
            mGluonViewSwitcher         = gluonViewSwitcher;
            mAssetSelection            = assetSelection;
            mIsGluonMode               = isGluonMode;
            mParentWindow              = parentWindow;

            mGuiMessage       = new UnityPlasticGuiMessage(parentWindow);
            mProgressControls = new EditorProgressControls(mGuiMessage);
        }
Ejemplo n.º 5
0
        static void DoActionButton(
            WorkspaceInfo workspaceInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonSwitcher,
            bool isGluonMode,
            bool isUpdateAction,
            GUIContent buttonContent,
            GUIStyle buttonStyle)
        {
            if (!GUILayout.Button(
                    buttonContent, buttonStyle,
                    GUILayout.ExpandHeight(true),
                    GUILayout.MinWidth(40)))
            {
                return;
            }

            if (isUpdateAction)
            {
                workspaceWindow.UpdateWorkspace();
                return;
            }

            ShowIncomingChangesForMode(
                workspaceInfo, mergeViewLauncher,
                gluonSwitcher, isGluonMode);
        }
Ejemplo n.º 6
0
        static void DrawIncomingChangesNotification(
            WorkspaceInfo wkInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher,
            IncomingChangesNotification notification,
            bool isGluonMode)
        {
            Images.Name iconName =
                notification.Status == PlasticNotification.Status.Conflicts ?
                Images.Name.IconConflicted :
                Images.Name.IconOutOfSync;

            DrawIcon(iconName);

            DrawNotificationLabel(notification.InfoText);

            if (DrawButton(notification.ActionText, notification.TooltipText))
            {
                if (notification.HasUpdateAction)
                {
                    workspaceWindow.UpdateWorkspace();
                    return;
                }

                ShowIncomingChangesForMode(
                    wkInfo,
                    mergeViewLauncher,
                    gluonViewSwitcher,
                    isGluonMode);
            }
        }
Ejemplo n.º 7
0
        internal static void BuildOperations(
            WorkspaceInfo wkInfo,
            WorkspaceWindow workspaceWindow,
            IViewSwitcher viewSwitcher,
            IHistoryViewLauncher historyViewLauncher,
            GluonGui.ViewHost viewHost,
            PlasticGui.WorkspaceWindow.NewIncomingChangesUpdater incomingChangesUpdater,
            IMergeViewLauncher mergeViewLauncher,
            PlasticGui.Gluon.IGluonViewSwitcher gluonViewSwitcher,
            EditorWindow parentWindow,
            bool isGluonMode)
        {
            if (!sIsEnabled)
            {
                Enable();
            }

            sOperations = new AssetOperations(
                wkInfo,
                workspaceWindow,
                viewSwitcher,
                historyViewLauncher,
                viewHost,
                incomingChangesUpdater,
                PlasticPlugin.AssetStatusCache,
                mergeViewLauncher,
                gluonViewSwitcher,
                parentWindow,
                sAssetSelection,
                isGluonMode);
        }
Ejemplo n.º 8
0
        internal PlasticGUIClient(
            WorkspaceInfo wkInfo,
            IViewSwitcher switcher,
            IMergeViewLauncher mergeViewLauncher,
            ViewHost viewHost,
            PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges,
            NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
            GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater,
            EditorWindow parentWindow,
            GuiMessage.IGuiMessage guiMessage)
        {
            mWkInfo            = wkInfo;
            mSwitcher          = switcher;
            mMergeViewLauncher = mergeViewLauncher;
            mViewHost          = viewHost;
            mPendingChanges    = pendingChanges;
            mDeveloperNewIncomingChangesUpdater = developerNewIncomingChangesUpdater;
            mGluonNewIncomingChangesUpdater     = gluonNewIncomingChangesUpdater;
            mPlasticWindow = parentWindow;
            mGuiMessage    = guiMessage;

            ((IWorkspaceWindow)this).UpdateTitle();

            mCheckedStateManager = new CheckedStateManager();

            mDeveloperProgressOperationHandler = new Developer.ProgressOperationHandler(mWkInfo, this);
            mGluonProgressOperationHandler     = new Gluon.ProgressOperationHandler(this);
        }
Ejemplo n.º 9
0
        internal BranchesTab(
            WorkspaceInfo wkInfo,
            IWorkspaceWindow workspaceWindow,
            IViewSwitcher viewSwitcher,
            IMergeViewLauncher mergeViewLauncher,
            IUpdateReport updateReport,
            NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
            EditorWindow parentWindow)
        {
            mWkInfo           = wkInfo;
            mParentWindow     = parentWindow;
            mProgressControls = new ProgressControlsForViews();

            mProgressControls = new ProgressControlsForViews();

            BuildComponents(
                wkInfo,
                workspaceWindow,
                viewSwitcher,
                mergeViewLauncher,
                updateReport,
                developerNewIncomingChangesUpdater,
                parentWindow);

            ((IRefreshableView)this).Refresh();
        }
 static CheckinDialog Create(
     WorkspaceInfo wkInfo,
     List<string> paths,
     IAssetStatusCache assetStatusCache,
     MetaCache metaCache,
     bool isGluonMode,
     ProgressControlsForDialogs progressControls,
     IWorkspaceWindow workspaceWindow,
     ViewHost viewHost,
     GuiMessage.IGuiMessage guiMessage,
     IMergeViewLauncher mergeViewLauncher,
     IGluonViewSwitcher gluonViewSwitcher)
 {
     var instance = CreateInstance<CheckinDialog>();
     instance.IsResizable = true;
     instance.minSize = new Vector2(520, 370);
     instance.mWkInfo = wkInfo;
     instance.mPaths = paths;
     instance.mAssetStatusCache = assetStatusCache;
     instance.mMetaCache = metaCache;
     instance.mIsGluonMode = isGluonMode;
     instance.mProgressControls = progressControls;
     instance.mWorkspaceWindow = workspaceWindow;
     instance.mViewHost = viewHost;
     instance.mGuiMessage = guiMessage;
     instance.mMergeViewLauncher = mergeViewLauncher;
     instance.mGluonViewSwitcher = gluonViewSwitcher;
     instance.mEnterKeyAction = instance.OkButtonAction;
     instance.mEscapeKeyAction = instance.CancelButtonAction;
     return instance;
 }
Ejemplo n.º 11
0
        internal PendingChangesTab(
            WorkspaceInfo wkInfo,
            ViewHost viewHost,
            bool isGluonMode,
            WorkspaceWindow workspaceWindow,
            IViewSwitcher switcher,
            IMergeViewLauncher mergeViewLauncher,
            IHistoryViewLauncher historyViewLauncher,
            PlasticGui.WorkspaceWindow.PendingChanges.PendingChanges pendingChanges,
            NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
            GluonNewIncomingChangesUpdater gluonNewIncomingChangesUpdater,
            IAssetStatusCache assetStatusCache,
            NotificationDrawer notificationDrawer,
            EditorWindow parentWindow)
        {
            mWkInfo              = wkInfo;
            mViewHost            = viewHost;
            mIsGluonMode         = isGluonMode;
            mWorkspaceWindow     = workspaceWindow;
            mHistoryViewLauncher = historyViewLauncher;
            mPendingChanges      = pendingChanges;
            mDeveloperNewIncomingChangesUpdater = developerNewIncomingChangesUpdater;
            mGluonNewIncomingChangesUpdater     = gluonNewIncomingChangesUpdater;
            mAssetStatusCache    = assetStatusCache;
            mNotificationDrawer  = notificationDrawer;
            mParentWindow        = parentWindow;
            mGuiMessage          = new UnityPlasticGuiMessage(parentWindow);
            mMergeViewLauncher   = mergeViewLauncher;
            mCheckedStateManager = new CheckedStateManager();

            mNewChangesInWk = NewChangesInWk.Build(
                mWkInfo,
                new BuildWorkspacekIsRelevantNewChange());

            BuildComponents(isGluonMode, parentWindow);

            mBorderColor = EditorGUIUtility.isProSkin
                ? (Color) new Color32(35, 35, 35, 255)
                : (Color) new Color32(153, 153, 153, 255);

            mProgressControls = new ProgressControlsForViews();

            workspaceWindow.RegisterPendingChangesProgressControls(mProgressControls);

            mPendingChangesOperations = new PendingChangesOperations(
                mWkInfo,
                workspaceWindow,
                switcher,
                mergeViewLauncher,
                this,
                mProgressControls,
                workspaceWindow,
                null,
                null,
                null);

            InitIgnoreRulesAndRefreshView(mWkInfo.ClientPath, this);
        }
        internal static void For(WorkspaceInfo workspaceInfo,
                                 WorkspaceWindow workspaceWindow,
                                 IMergeViewLauncher mergeViewLauncher,
                                 IGluonViewSwitcher gluonSwitcher,
                                 bool isGluonMode,
                                 bool isVisible,
                                 NotificationPanelData notificationPanelData)
        {
            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            var icon = Images.GetImage(
                notificationPanelData.NotificationStyle == NotificationPanelData.StyleType.Green
                ? Images.Name.DownloadIconGreen : Images.Name.DownloadIconRed);

            GUILayout.Label(icon, GUILayout.Height(16), GUILayout.Width(16));

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();


            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            GUIStyle labelStyle = new GUIStyle(EditorStyles.label);

            labelStyle.fontStyle = FontStyle.Bold;
            GUILayout.Label(notificationPanelData.InfoText, labelStyle);

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            GUILayout.FlexibleSpace();

            GUIStyle buttonStyle = new GUIStyle(EditorStyles.miniButtonLeft);

            buttonStyle.fixedWidth = 60;
            DoActionButton(
                workspaceInfo, workspaceWindow,
                mergeViewLauncher, gluonSwitcher, isGluonMode,
                notificationPanelData.HasUpdateAction,
                new GUIContent(
                    notificationPanelData.ActionText, notificationPanelData.TooltipText), buttonStyle);

            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();
        }
Ejemplo n.º 13
0
        static void ShowIncomingChangesForMode(
            WorkspaceInfo workspaceInfo,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonSwitcher,
            bool isGluonMode)
        {
            if (isGluonMode)
            {
                GluonShowIncomingChanges.FromNotificationBar(
                    workspaceInfo, gluonSwitcher);
                return;
            }

            ShowIncomingChanges.FromNotificationBar(
                workspaceInfo, mergeViewLauncher);
        }
Ejemplo n.º 14
0
        void BuildComponents(
            WorkspaceInfo wkInfo,
            IWorkspaceWindow workspaceWindow,
            IViewSwitcher viewSwitcher,
            IMergeViewLauncher mergeViewLauncher,
            IUpdateReport updateReport,
            NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
            EditorWindow parentWindow)
        {
            mSearchField = new SearchField();
            mSearchField.downOrUpArrowKeyPressed += SearchField_OnDownOrUpArrowKeyPressed;

            DateFilter.Type dateFilterType =
                EnumPopupSetting <DateFilter.Type> .Load(
                    UnityConstants.BRANCHES_DATE_FILTER_SETTING_NAME,
                    DateFilter.Type.LastMonth);

            mDateFilter = new DateFilter(dateFilterType);

            BranchesListHeaderState headerState =
                BranchesListHeaderState.GetDefault();

            TreeHeaderSettings.Load(headerState,
                                    UnityConstants.BRANCHES_TABLE_SETTINGS_NAME,
                                    (int)BranchesListColumn.CreationDate, false);

            mBranchesListView = new BranchesListView(
                headerState,
                BranchesListHeaderState.GetColumnNames(),
                new BranchesViewMenu(this),
                sizeChangedAction: OnBranchesListViewSizeChanged);

            mBranchesListView.Reload();

            mBranchOperations = new BranchOperations(
                wkInfo,
                workspaceWindow,
                viewSwitcher,
                mergeViewLauncher,
                this,
                ViewType.BranchesView,
                mProgressControls,
                updateReport,
                new ContinueWithPendingChangesQuestionerBuilder(viewSwitcher, parentWindow),
                developerNewIncomingChangesUpdater);
        }
Ejemplo n.º 15
0
        internal static void For(
            WorkspaceInfo workspaceInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonSwitcher,
            bool isGluonMode,
            IIncomingChangesNotificationPanel notificationPanel)
        {
            var barStyle = new GUIStyle();

            var barTexture = GetBarTexture();

            barTexture.SetPixel(0, 0, UnityStyles.Colors.BackgroundBar);
            barTexture.Apply();

            barStyle.normal.background = barTexture;

            EditorGUILayout.BeginVertical(barStyle, GUILayout.Height(mBarHeight));
            GUILayout.FlexibleSpace();

            EditorGUILayout.BeginHorizontal();

            if (notificationPanel.IsVisible)
            {
                DrawIncomingChangesNotificationPanel.For(
                    workspaceInfo,
                    workspaceWindow,
                    mergeViewLauncher,
                    gluonSwitcher,
                    isGluonMode,
                    notificationPanel.IsVisible,
                    notificationPanel.Data);
            }

            GUILayout.FlexibleSpace();

            DrawStatusBarIcon();
            DrawStatusBarLabel(workspaceWindow.WorkspaceStatus);

            EditorGUILayout.EndHorizontal();

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();
        }
        internal WorkspaceWindow(
            WorkspaceInfo wkInfo,
            ViewHost viewHost,
            ViewSwitcher switcher,
            IMergeViewLauncher mergeViewLauncher,
            NewIncomingChangesUpdater developerNewIncomingChangesUpdater,
            EditorWindow parentWindow)
        {
            mWkInfo            = wkInfo;
            mViewHost          = viewHost;
            mSwitcher          = switcher;
            mMergeViewLauncher = mergeViewLauncher;
            mDeveloperNewIncomingChangesUpdater = developerNewIncomingChangesUpdater;
            mPlasticWindow = parentWindow;
            mGuiMessage    = new UnityPlasticGuiMessage(parentWindow);

            mDeveloperProgressOperationHandler = new Developer.ProgressOperationHandler(mWkInfo, this);
            mGluonProgressOperationHandler     = new Gluon.ProgressOperationHandler(this);
            mOperationProgressData             = new OperationProgressData();

            ((IWorkspaceWindow)this).UpdateTitle();
        }
Ejemplo n.º 17
0
        internal void OnGUI(
            WorkspaceInfo wkInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonViewSwitcher,
            IIncomingChangesNotifier incomingChangesNotifier,
            bool isGluonMode)
        {
            EditorGUILayout.BeginVertical(
                GetBarStyle(),
                GUILayout.Height(UnityConstants.STATUS_BAR_HEIGHT));
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginHorizontal();

            if (incomingChangesNotifier.HasNotification)
            {
                DrawIncomingChangesNotification(
                    wkInfo,
                    workspaceWindow,
                    mergeViewLauncher,
                    gluonViewSwitcher,
                    incomingChangesNotifier.Notification,
                    isGluonMode);
            }

            if (mNotification != null)
            {
                DrawNotification(mNotification);
            }

            GUILayout.FlexibleSpace();

            DrawWorkspaceStatus(workspaceWindow.WorkspaceStatus);

            EditorGUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 18
0
        internal static void ForMode(
            WorkspaceInfo workspaceInfo,
            WorkspaceWindow workspaceWindow,
            IMergeViewLauncher mergeViewLauncher,
            IGluonViewSwitcher gluonSwitcher,
            bool isGluonMode,
            bool isVisible,
            NotificationPanelData notificationPanelData)
        {
            if (!isVisible)
            {
                return;
            }

            GUIContent labelContent = new GUIContent(
                notificationPanelData.InfoText, notificationPanelData.TooltipText);
            GUIContent buttonContent = new GUIContent(
                notificationPanelData.ActionText, notificationPanelData.TooltipText);

            float panelWidth = GetPanelWidth(
                labelContent, buttonContent,
                UnityStyles.Notification.Label, EditorStyles.miniButton);

            EditorGUILayout.BeginHorizontal(
                GetStyle(notificationPanelData.NotificationStyle),
                GUILayout.Width(panelWidth));

            GUILayout.Label(labelContent, UnityStyles.Notification.Label);

            DoActionButton(
                workspaceInfo, workspaceWindow,
                mergeViewLauncher, gluonSwitcher, isGluonMode,
                notificationPanelData.HasUpdateAction,
                buttonContent, EditorStyles.miniButton);

            EditorGUILayout.EndHorizontal();
        }
Ejemplo n.º 19
0
        internal static void CheckinPaths(
            WorkspaceInfo wkInfo,
            List <string> paths,
            string comment,
            IWorkspaceWindow workspaceWindow,
            CheckinDialog dialog,
            GuiMessage.IGuiMessage guiMessage,
            IProgressControls progressControls,
            IMergeViewLauncher mergeViewLauncher)
        {
            BaseCommandsImpl baseCommands = new BaseCommandsImpl();

            progressControls.ShowProgress("Checkin in files");

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                CheckinParams ciParams = new CheckinParams();
                ciParams.paths         = paths.ToArray();
                ciParams.comment       = comment;
                ciParams.time          = DateTime.MinValue;
                ciParams.flags         = CheckinFlags.Recurse | CheckinFlags.ProcessSymlinks;

                baseCommands.CheckIn(ciParams);
            },
                /*afterOperationDelegate*/ delegate
            {
                progressControls.HideProgress();
                ((IPlasticDialogCloser)dialog).CloseDialog();

                if (waiter.Exception is CmClientMergeNeededException ||
                    waiter.Exception is CmClientUpdateMergeNeededException)
                {
                    // we need to explicitly call EditorWindow.Close() to ensure
                    // that the dialog is closed before asking the user
                    dialog.Close();

                    if (!UserWantsToShowIncomingView(guiMessage))
                    {
                        return;
                    }

                    ShowIncomingChanges.FromCheckin(
                        wkInfo,
                        mergeViewLauncher,
                        progressControls);

                    return;
                }

                if (waiter.Exception != null)
                {
                    ExceptionsHandler.DisplayException(waiter.Exception);
                    return;
                }

                workspaceWindow.RefreshView(ViewType.PendingChangesView);
                workspaceWindow.RefreshView(ViewType.HistoryView);
            });
        }