Example #1
0
        internal static void CheckinPathsPartial(
            WorkspaceInfo wkInfo,
            List <string> paths,
            string comment,
            ViewHost viewHost,
            CheckinDialog dialog,
            GuiMessage.IGuiMessage guiMessage,
            IProgressControls progressControls,
            IGluonViewSwitcher gluonViewSwitcher)
        {
            BaseCommandsImpl baseCommands = new BaseCommandsImpl();

            progressControls.ShowProgress(PlasticLocalization.GetString(
                                              PlasticLocalization.Name.CheckinInFilesProgress));

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(50);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                baseCommands.PartialCheckin(wkInfo, paths, comment);
            },
                /*afterOperationDelegate*/ delegate
            {
                progressControls.HideProgress();

                ((IPlasticDialogCloser)dialog).CloseDialog();

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

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

                    gluonViewSwitcher.ShowIncomingChangesView();
                    return;
                }

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

                viewHost.RefreshView(ViewType.CheckinView);
                viewHost.RefreshView(ViewType.HistoryView);
            });
        }
Example #2
0
        void PartialUpdateWorkspace()
        {
            mProgressControls.ShowProgress(PlasticLocalization.GetString(
                                               PlasticLocalization.Name.UpdatingWorkspace));

            ((IUpdateProgress)mGluonProgressOperationHandler).ShowCancelableProgress();

            OutOfDateUpdater outOfDateUpdater = new OutOfDateUpdater(mWkInfo);

            BuildProgressSpeedAndRemainingTime.ProgressData progressData =
                new BuildProgressSpeedAndRemainingTime.ProgressData(DateTime.Now);

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                outOfDateUpdater.Execute();
            },
                /*afterOperationDelegate*/ delegate
            {
                mProgressControls.HideProgress();

                ((IUpdateProgress)mGluonProgressOperationHandler).EndProgress();

                mViewHost.RefreshView(ViewType.CheckinView);
                mViewHost.RefreshView(ViewType.IncomingChangesView);

                RefreshAsset.UnityAssetDatabase();

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

                ShowUpdateReportDialog(
                    mWkInfo, mViewHost, outOfDateUpdater.Progress, mProgressControls,
                    mGuiMessage, mGluonProgressOperationHandler, this);
            },
                /*timerTickDelegate*/ delegate
            {
                UpdateProgress progress = outOfDateUpdater.Progress;

                if (progress == null)
                {
                    return;
                }

                if (progress.IsCanceled)
                {
                    mProgressControls.ShowNotification(
                        PlasticLocalization.GetString(PlasticLocalization.Name.Canceling));
                }

                ((IUpdateProgress)mGluonProgressOperationHandler).RefreshProgress(
                    progress,
                    UpdateProgressDataCalculator.CalculateProgressForWorkspaceUpdate(
                        mWkInfo.ClientPath, progress, progressData));
            });
        }