Ejemplo n.º 1
0
        void FillData(
            MountPointWithPath mountWithPath,
            ChangesetInfo csetInfo)
        {
            mSelectedMountWithPath = mountWithPath;
            mSelectedChangesetInfo = csetInfo;

            ((IProgressControls)mProgressControls).ShowProgress(
                PlasticLocalization.GetString(PlasticLocalization.Name.Loading));

            mIsSkipMergeTrackingButtonVisible = false;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(100);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                mDiffs = PlasticGui.Plastic.API.GetChangesetDifferences(
                    mountWithPath, csetInfo);
            },
                /*afterOperationDelegate*/ delegate
            {
                ((IProgressControls)mProgressControls).HideProgress();

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

                if (mSelectedMountWithPath != mountWithPath ||
                    mSelectedChangesetInfo != csetInfo)
                {
                    return;
                }

                if (mDiffs == null || mDiffs.Count == 0)
                {
                    ClearDiffs();
                    return;
                }

                mIsSkipMergeTrackingButtonVisible =
                    ClientDiffList.HasMerges(mDiffs);

                bool skipMergeTracking =
                    mIsSkipMergeTrackingButtonVisible &&
                    mIsSkipMergeTrackingButtonChecked;

                UpdateDiffTreeView(
                    mDiffs, skipMergeTracking, mDiffTreeView);
            });
        }
Ejemplo n.º 2
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);
            });
        }
Ejemplo n.º 3
0
 internal static void Open(List <string> files)
 {
     try
     {
         foreach (string file in files)
         {
             OpenFile(file);
         }
     }
     catch (Exception ex)
     {
         ExceptionsHandler.DisplayException(ex);
     }
 }
Ejemplo n.º 4
0
        void IAssetMenuOperations.ShowDiff()
        {
            if (LaunchTool.ShowDownloadPlasticExeWindow(
                    mWkInfo,
                    mIsGluonMode,
                    TrackFeatureUseEvent.Features.InstallPlasticCloudFromShowDiff,
                    TrackFeatureUseEvent.Features.InstallPlasticEnterpriseFromFromShowDiff,
                    TrackFeatureUseEvent.Features.CancelPlasticInstallationFromFromShowDiff))
            {
                return;
            }

            string selectedPath = AssetsSelection.GetSelectedPath(
                mAssetSelection.GetSelectedAssets());

            DiffInfo diffInfo = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                string symbolicName = GetSymbolicName(selectedPath);
                string extension    = Path.GetExtension(selectedPath);

                diffInfo = PlasticGui.Plastic.API.BuildDiffInfoForDiffWithPrevious(
                    selectedPath, symbolicName, selectedPath, extension, mWkInfo);
            },
                /*afterOperationDelegate*/ delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.DisplayException(waiter.Exception);
                    return;
                }

                DiffOperation.DiffWithPrevious(
                    diffInfo,
                    null,
                    null);
            });
        }
Ejemplo n.º 5
0
        internal void ShowBranchesViewIfNeeded()
        {
            if (!BoolSetting.Load(UnityConstants.SHOW_BRANCHES_VIEW_KEY_NAME, true))
            {
                return;
            }

            string query = QueryConstants.BranchesBeginningQuery;

            ViewQueryResult queryResult = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                queryResult = new ViewQueryResult(
                    PlasticGui.Plastic.API.FindQuery(mWkInfo, query));
            },
                /*afterOperationDelegate*/ delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.DisplayException(waiter.Exception);
                    return;
                }

                if (queryResult == null)
                {
                    return;
                }

                if (queryResult.Count() > 0)
                {
                    OpenBranchesTab();
                }
            });
        }
Ejemplo n.º 6
0
        void IRefreshableView.Refresh()
        {
            BranchInfo workingBranch = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter(10);

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                workingBranch = OverlappedCalculator.GetWorkingBranch(
                    mWkInfo.ClientPath);
            },
                /*afterOperationDelegate*/ delegate
            {
                if (waiter.Exception != null)
                {
                    ExceptionsHandler.DisplayException(waiter.Exception);
                    return;
                }

                mMergeController.UpdateMergeObjectInfoIfNeeded(workingBranch);
                mMergeViewLogic.Refresh();
            });
        }
Ejemplo n.º 7
0
        void FillBranches(WorkspaceInfo wkInfo, string query, List <RepObjectInfo> branchesToSelect)
        {
            if (mIsRefreshing)
            {
                return;
            }

            mIsRefreshing = true;

            int defaultRow = TableViewOperations.
                             GetFirstSelectedRow(mBranchesListView);

            ((IProgressControls)mProgressControls).ShowProgress(
                PlasticLocalization.GetString(
                    PlasticLocalization.Name.LoadingBranches));

            ViewQueryResult queryResult = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                long loadedBranchId = GetLoadedBranchId(wkInfo);
                lock (mLock)
                {
                    mLoadedBranchId = loadedBranchId;
                }

                queryResult = new ViewQueryResult(
                    PlasticGui.Plastic.API.FindQuery(wkInfo, query));
            },
                /*afterOperationDelegate*/ delegate
            {
                try
                {
                    if (waiter.Exception != null)
                    {
                        ExceptionsHandler.DisplayException(waiter.Exception);
                        return;
                    }

                    UpdateBranchesList(
                        mBranchesListView,
                        queryResult,
                        mLoadedBranchId);

                    int branchesCount = GetBranchesCount(queryResult);

                    if (branchesCount == 0)
                    {
                        return;
                    }

                    BranchesSelection.SelectBranches(
                        mBranchesListView, branchesToSelect, defaultRow);
                }
                finally
                {
                    ((IProgressControls)mProgressControls).HideProgress();
                    mIsRefreshing = false;
                }
            });
        }
Ejemplo n.º 8
0
        void FillChangesets(WorkspaceInfo wkInfo, string query)
        {
            if (mIsRefreshing)
            {
                return;
            }

            mIsRefreshing = true;

            List <RepObjectInfo> changesetsToSelect =
                ChangesetsSelection.GetSelectedRepObjectInfos(mChangesetsListView);

            int defaultRow = TableViewOperations.
                             GetFirstSelectedRow(mChangesetsListView);

            ((IProgressControls)mProgressControls).ShowProgress(
                PlasticLocalization.GetString(
                    PlasticLocalization.Name.LoadingChangesets));

            long            loadedChangesetId = -1;
            ViewQueryResult queryResult       = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                queryResult = new ViewQueryResult(
                    PlasticGui.Plastic.API.FindQuery(wkInfo, query));

                loadedChangesetId = GetLoadedChangesetId(
                    wkInfo, mIsGluonMode);
            },
                /*afterOperationDelegate*/ delegate
            {
                try
                {
                    if (waiter.Exception != null)
                    {
                        ExceptionsHandler.DisplayException(waiter.Exception);
                        return;
                    }

                    int changesetsCount = GetChangesetsCount(queryResult);

                    mChangesetsLabelText = string.Format(
                        PlasticLocalization.GetString(PlasticLocalization.Name.ChangesetsCount),
                        changesetsCount);

                    UpdateChangesetsList(
                        mChangesetsListView,
                        queryResult,
                        loadedChangesetId);

                    if (changesetsCount == 0)
                    {
                        mDiffPanel.ClearInfo();
                        return;
                    }

                    ChangesetsSelection.SelectChangesets(
                        mChangesetsListView, changesetsToSelect, defaultRow);
                }
                finally
                {
                    ((IProgressControls)mProgressControls).HideProgress();
                    mIsRefreshing = false;
                }
            });
        }
Ejemplo n.º 9
0
        void FillPendingChanges(INewChangesInWk newChangesInWk)
        {
            if (mIsRefreshing)
            {
                return;
            }

            mIsRefreshing = true;

            List <ChangeInfo> changesToSelect =
                PendingChangesSelection.GetChangesToFocus(mChangesTreeView);

            mProgressControls.ShowProgress(PlasticLocalization.GetString(
                                               PlasticLocalization.Name.LoadingPendingChanges));

            IDictionary <MountPoint, IList <PendingMergeLink> > mergeLinks = null;

            IThreadWaiter waiter = ThreadWaiter.GetWaiter();

            waiter.Execute(
                /*threadOperationDelegate*/ delegate
            {
                FilterManager.Get().Reload();

                WorkspaceStatusOptions options = WorkspaceStatusOptions.None;
                options |= WorkspaceStatusOptions.FindAdded;
                options |= WorkspaceStatusOptions.FindDeleted;
                options |= WorkspaceStatusOptions.FindMoved;
                options |= WorkspaceStatusOptions.SplitModifiedMoved;
                options |= PendingChangesOptions.GetWorkspaceStatusOptions();

                if (newChangesInWk != null)
                {
                    newChangesInWk.Detected();
                }

                mPendingChanges.Calculate(
                    options, PendingChangesOptions.GetMovedMatchingOptions());

                mergeLinks = Plastic.API.GetPendingMergeLinks(mWkInfo);
            },
                /*afterOperationDelegate*/ delegate
            {
                mPendingMergeLinks = mergeLinks;

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

                    UpdateChangesTree();

                    UpdateMergeLinksList();

                    PendingChangesSelection.SelectChanges(
                        mChangesTreeView, changesToSelect);
                }
                finally
                {
                    mProgressControls.HideProgress();

                    UpdateIsCommentWarningNeeded(CommentText);

                    UpdateNotificationPanel();

                    mIsRefreshing = false;
                }
            });
        }
        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));
            });
        }
Ejemplo n.º 11
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);
            });
        }