Пример #1
0
        /// <see cref="Ankh.Commands.ICommandHandler.OnExecute" />
        public void OnExecute(CommandEventArgs e)
        {
            List <SvnItem>  svnItems = new List <SvnItem>();
            ISvnStatusCache cache    = e.GetService <ISvnStatusCache>();

            switch (e.Command)
            {
            case AnkhCommand.ItemMerge:
                // TODO: Check for solution and/or project selection to use the folder instead of the file
                foreach (SvnItem item in e.Selection.GetSelectedSvnItems(false))
                {
                    svnItems.Add(item);
                }
                break;

            case AnkhCommand.ProjectMerge:
                foreach (SccProject p in e.Selection.GetSelectedProjects(false))
                {
                    IProjectFileMapper pfm = e.GetService <IProjectFileMapper>();

                    ISccProjectInfo info = pfm.GetProjectInfo(p);
                    if (info != null && info.ProjectDirectory != null)
                    {
                        svnItems.Add(cache[info.ProjectDirectory]);
                    }
                }
                break;

            case AnkhCommand.SolutionMerge:
                svnItems.Add(cache[e.GetService <IAnkhSolutionSettings>().ProjectRoot]);
                break;

            default:
                throw new InvalidOperationException();
            }

            IEnumerable <string>     selectedFiles = e.Selection.GetSelectedFiles(true);
            IAnkhOpenDocumentTracker tracker       = e.GetService <IAnkhOpenDocumentTracker>();

            using (DocumentLock lck = tracker.LockDocuments(selectedFiles, DocumentLockType.ReadOnly))
                using (lck.MonitorChangesForReload())
                    using (MergeWizard dialog = new MergeWizard(e.Context, svnItems[0]))
                    {
                        DialogResult result = dialog.ShowDialog(e.Context);
                        //result = uiService.ShowDialog(dialog);

                        if (result == DialogResult.OK)
                        {
                            using (MergeResultsDialog mrd = new MergeResultsDialog())
                            {
                                mrd.MergeActions           = dialog.MergeActions;
                                mrd.ResolvedMergeConflicts = dialog.ResolvedMergeConflicts;

                                mrd.ShowDialog(e.Context);
                            }
                        }
                    }
        }
Пример #2
0
        /// <see cref="Ankh.Commands.ICommandHandler.OnExecute" />
        public void OnExecute(CommandEventArgs e)
        {
            List<SvnItem> svnItems = new List<SvnItem>();
            IFileStatusCache cache = e.GetService<IFileStatusCache>();

            switch (e.Command)
            {
                case AnkhCommand.ItemMerge:
                    // TODO: Check for solution and/or project selection to use the folder instead of the file
                    foreach (SvnItem item in e.Selection.GetSelectedSvnItems(false))
                    {
                        svnItems.Add(item);
                    }
                    break;
                case AnkhCommand.ProjectMerge:
                    foreach (SvnProject p in e.Selection.GetSelectedProjects(false))
                    {
                        IProjectFileMapper pfm = e.GetService<IProjectFileMapper>();

                        ISvnProjectInfo info = pfm.GetProjectInfo(p);
                        if (info != null && info.ProjectDirectory != null)
                        {
                            svnItems.Add(cache[info.ProjectDirectory]);
                        }
                    }
                    break;
                case AnkhCommand.SolutionMerge:
                    svnItems.Add(cache[e.GetService<IAnkhSolutionSettings>().ProjectRoot]);
                    break;
                default:
                    throw new InvalidOperationException();
            }

            IEnumerable<string> selectedFiles = e.Selection.GetSelectedFiles(true);
            IAnkhOpenDocumentTracker tracker = e.GetService<IAnkhOpenDocumentTracker>();

            using (DocumentLock lck = tracker.LockDocuments(selectedFiles, DocumentLockType.ReadOnly))
            using (lck.MonitorChangesForReload())
            using (MergeWizard dialog = new MergeWizard(e.Context, svnItems[0]))
            {
                DialogResult result = dialog.ShowDialog(e.Context);
                //result = uiService.ShowDialog(dialog);

                if (result == DialogResult.OK)
                {
                    using (MergeResultsDialog mrd = new MergeResultsDialog())
                    {
                        mrd.MergeActions = dialog.MergeActions;
                        mrd.ResolvedMergeConflicts = dialog.ResolvedMergeConflicts;

                        mrd.ShowDialog(e.Context);
                    }
                }

            }
        }