Beispiel #1
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            foreach (SccProject p in e.Selection.GetSelectedProjects(false))
            {
                ISccProjectInfo pi = e.GetService <IProjectFileMapper>().GetProjectInfo(p);

                if (p == null || pi == null || string.IsNullOrEmpty(pi.ProjectFile))
                {
                    break; // No project file
                }

                if (!string.IsNullOrEmpty(pi.ProjectDirectory) &&
                    string.Equals(pi.ProjectDirectory, pi.ProjectFile, StringComparison.OrdinalIgnoreCase))
                {
                    break; // Project file is directory
                }

                SvnItem item = e.GetService <ISvnStatusCache>()[pi.ProjectFile];

                if (item != null && item.IsDirectory)
                {
                    break; // Project file is not file
                }
                return;    // Show the menu
            }

            e.Enabled = e.Visible = false;
        }
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_control == null)
            {
                _control = e.GetService <SvnInfoGridControl>();

                if (_control == null)
                {
                    e.Enabled = false;
                    return;
                }
            }

            PropertySort sort = _control.Grid.PropertySort;

            bool categorized = (PropertySort.NoSort != (sort & PropertySort.Categorized));

            if (e.Command == AnkhCommand.SvnInfoAlphabetical)
            {
                e.Checked = !categorized;
            }
            else
            {
                e.Checked = categorized;
            }
        }
Beispiel #3
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <LogToolWindowControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = e.Visible = false;
                return;
            }

            IList <SvnOrigin> origins = _ctrl.Origins;

            if (origins == null || origins.Count == 0)
            {
                e.Enabled = e.Visible = false;
                return;
            }

            // Enable something like this?

            /*if (e.Command == AnkhCommand.SvnLogComboBox
             *  && origins.Count == 1)
             * {
             *  e.Enabled = false;
             * }*/
        }
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            IAnkhIssueService service = null;
            SvnItem           item    = null;

            e.Enabled = true &&
                        (item = GetRoot(e)) != null &&
                        item.IsVersioned && // ensure solution (project root) is versioned
                        (service = e.GetService <IAnkhIssueService>()) != null &&
                        service.Connectors != null &&
                        service.Connectors.Count > 0;
        }
Beispiel #5
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <LogToolWindowControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = false;
            }
        }
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <RepositoryExplorerControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = e.Visible = false;
                return;
            }
        }
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (e.State.SolutionBuilding || e.State.Debugging || e.State.SolutionOpening)
            {
                e.Enabled = false;
                return;
            }

            PendingCommitsPage commitPage = e.GetService <PendingCommitsPage>();
            PendingIssuesPage  issuesPage = e.GetService <PendingIssuesPage>();

            if (commitPage == null)
            {
                e.Enabled = false;
                return;
            }

            switch (e.Command)
            {
            case AnkhCommand.CommitPendingChanges:
            case AnkhCommand.CommitPendingChangesKeepingLocks:
                e.Enabled = true
                            // check if commit page or issues page is visible
                            && (false ||
                                commitPage.Visible ||
                                (issuesPage != null && issuesPage.Visible)
                                )
                            // make sure commit page can commit
                            && commitPage.CanCommit(e.Command == AnkhCommand.CommitPendingChangesKeepingLocks)
                ;
                break;

            case AnkhCommand.PendingChangesApplyWorkingCopy:
                e.Enabled = commitPage.Visible && commitPage.CanApplyToWorkingCopy();
                break;
            }
        }
Beispiel #8
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <LogToolWindowControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = false;
                return;
            }

            e.Checked = _ctrl.IncludeMergedRevisions;
        }
Beispiel #9
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <LogToolWindowControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = false;
                return;
            }

            e.Checked = _ctrl.ShowLogMessage;
        }
Beispiel #10
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            e.Enabled = e.Visible = false;

            // We use this command in Visual Studio 2005/2008 to make all commands visible
            // in the menu/toolbar editor.

            // We explicitly disable this in VS-Versions that don't use this to make sure
            // we don't accidentally enable the customize mode

            if (VSVersion.VS2008OrOlder)
            {
                e.GetService <CommandMapper>().EnableCustomizeMode();
            }
        }
Beispiel #11
0
        public virtual void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_control == null)
            {
                _control = e.GetService <SvnInfoGridControl>();

                if (_control == null)
                {
                    e.Enabled = false;
                    return;
                }
            }

            GC.KeepAlive(GetNames(e));
        }
Beispiel #12
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            if (_ctrl == null)
            {
                _ctrl = e.GetService <LogToolWindowControl>();
            }

            if (_ctrl == null)
            {
                e.Enabled = false;
                return;
            }

            if (UpdateForChangedFiles(e))
            {
                return;
            }

            UpdateForRevChanges(_ctrl, e);
        }
Beispiel #13
0
        public override void OnUpdate(CommandUpdateEventArgs e)
        {
            base.OnUpdate(e);


            if (e.Enabled && e.Command == AnkhCommand.ViewInVsNet)
            {
                ISvnRepositoryItem    single   = EnumTools.GetSingle(e.Selection.GetSelection <ISvnRepositoryItem>());
                IAnkhSolutionSettings settings = e.GetService <IAnkhSolutionSettings>();

                SvnOrigin origin = single.Origin; // Checked in parent

                string ext = Path.GetExtension(origin.Target.FileName);

                if (!string.IsNullOrEmpty(ext) && settings.OpenFileFilter.IndexOf("*" + ext, StringComparison.OrdinalIgnoreCase) < 0)
                {
                    e.Enabled = false;
                }
            }
        }
Beispiel #14
0
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            object fm = e.Selection.Cache[_failedProjectsKey];
            IDictionary <string, object> map;

#if !DEBUG
            if (e.Command == AnkhCommand.SccEditFailedProjectLocation)
            {
                e.Enabled = false;
                return;
            }
#endif

            if (fm != null)
            {
                map = (fm as IDictionary <string, object>);
            }
            else
            {
                SvnSccProvider scc = e.GetService <SvnSccProvider>();
                map = scc.GetProjectsThatNeedEnlisting();
                e.Selection.Cache[_failedProjectsKey] = map ?? _failedProjectsKey;
            }

            if (map != null)
            {
                SccHierarchy hier = EnumTools.GetSingle(e.Selection.GetSelectedHierarchies());

                //  if ( hier != null && !String.IsNullOrEmpty(hier.Name) && map.ContainsKey(hier.Name) )
                // alllucly1996-dũng: I saw IsNullOrEmpty(hier.Name) seems unnecessary
                if (hier != null && map.ContainsKey(hier.Name))
                {
                    return;
                }
            }

            e.Enabled = false;
        }
Beispiel #15
0
        void UpdateForRevChanges(ILogControl logWindow, CommandUpdateEventArgs e)
        {
            SvnOrigin first = EnumTools.GetSingle(logWindow.Origins);

            if (first == null)
            {
                e.Enabled = false;
                return;
            }

            SvnPathTarget pt = first.Target as SvnPathTarget;

            if (pt != null)
            {
                if (e.GetService <ISvnStatusCache>()[pt.FullPath].IsDirectory)
                {
                    // We can't diff directories at this time
                    e.Enabled = false;
                    return;
                }
            }

            // Note: We can't have a local directory, but we can have a remote one.
        }
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            ISvnLogItem item = EnumTools.GetSingle(e.Selection.GetSelection <ISvnLogItem>());

            if (item != null)
            {
                ILogControl logWindow = e.Selection.GetActiveControl <ILogControl>();

                if (logWindow != null)
                {
                    SvnOrigin origin = EnumTools.GetSingle(logWindow.Origins);

                    if (origin != null)
                    {
                        SvnPathTarget pt = origin.Target as SvnPathTarget;

                        if (pt != null)
                        {
                            SvnItem svnItem = e.GetService <ISvnStatusCache>()[pt.FullPath];

                            if (svnItem != null && !svnItem.IsDirectory)
                            {
                                if (null == e.Selection.GetActiveControl <ILogControl>())
                                {
                                    e.Enabled = false;
                                }

                                return;
                            }
                        }
                    }
                }
            }

            e.Enabled = false;
        }
Beispiel #17
0
        public override void OnUpdate(CommandUpdateEventArgs e)
        {
            base.OnUpdate(e);

            if (e.Enabled && e.Command == AnkhCommand.ViewInVsNet)
            {
                ISvnRepositoryItem single = EnumTools.GetSingle(e.Selection.GetSelection<ISvnRepositoryItem>());
                IAnkhSolutionSettings settings = e.GetService<IAnkhSolutionSettings>();

                SvnOrigin origin = single.Origin; // Checked in parent

                string ext = Path.GetExtension(origin.Target.FileName);

                if (!string.IsNullOrEmpty(ext) && settings.OpenFileFilter.IndexOf("*" + ext, StringComparison.OrdinalIgnoreCase) < 0)
                    e.Enabled = false;
            }
        }
Beispiel #18
0
        /// <see cref="Ankh.Commands.ICommandHandler.OnUpdate" />
        public void OnUpdate(CommandUpdateEventArgs e)
        {
            ISvnStatusCache statusCache;
            int             n = 0;

            switch (e.Command)
            {
            case AnkhCommand.ItemMerge:
                foreach (SvnItem item in e.Selection.GetSelectedSvnItems(false))
                {
                    if (!item.IsVersioned)
                    {
                        e.Enabled = false;
                        return;
                    }

                    n++;

                    if (n > 1)
                    {
                        break;
                    }
                }
                break;

            case AnkhCommand.ProjectMerge:
                statusCache = e.GetService <ISvnStatusCache>();
                IProjectFileMapper pfm = e.GetService <IProjectFileMapper>();
                foreach (SccProject project in e.Selection.GetSelectedProjects(false))
                {
                    ISccProjectInfo projInfo = pfm.GetProjectInfo(project);
                    if (projInfo == null || string.IsNullOrEmpty(projInfo.ProjectDirectory))
                    {
                        e.Enabled = false;
                        return;
                    }
                    SvnItem projectDir = statusCache[projInfo.ProjectDirectory];
                    if (!projectDir.IsVersioned)
                    {
                        e.Enabled = false;
                        return;
                    }

                    n++;

                    if (n > 1)
                    {
                        break;
                    }
                }
                break;

            case AnkhCommand.SolutionMerge:
                statusCache = e.GetService <ISvnStatusCache>();
                IAnkhSolutionSettings solutionSettings = e.GetService <IAnkhSolutionSettings>();
                if (solutionSettings == null || string.IsNullOrEmpty(solutionSettings.ProjectRoot))
                {
                    e.Enabled = false;
                    return;
                }
                SvnItem solutionItem = statusCache[solutionSettings.ProjectRoot];
                if (solutionItem.IsVersioned)
                {
                    n = 1;
                }
                break;

            default:
                throw new InvalidOperationException();
            }

            if (n != 1)
            {
                e.Enabled = false;
            }
        }