Example #1
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context, object argument, bool promptUser, bool dontPromptUser)
     : this(command, context)
 {
     _argument       = argument;
     _promptUser     = promptUser;
     _dontPromptUser = dontPromptUser;
 }
Example #2
0
        public int QueryStatus(AnkhContext context, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            else if (cCmds != 1 || prgCmds == null)
            {
                return(-1);
            }

            TextQueryType textQuery = TextQueryType.None;

            if (pCmdText != IntPtr.Zero)
            {
                // VS Want's some text from us for either the statusbar or the command text
                OLECMDTEXTF textType = GetFlags(pCmdText);

                switch (textType)
                {
                case OLECMDTEXTF.OLECMDTEXTF_NAME:
                    textQuery = TextQueryType.Name;
                    break;

                case OLECMDTEXTF.OLECMDTEXTF_STATUS:
                    textQuery = TextQueryType.Status;
                    break;
                }
            }

            CommandUpdateEventArgs updateArgs = new CommandUpdateEventArgs((AnkhCommand)prgCmds[0].cmdID, context, textQuery);

            OLECMDF cmdf = OLECMDF.OLECMDF_SUPPORTED;

            if (PerformUpdate(updateArgs.Command, updateArgs))
            {
                updateArgs.UpdateFlags(ref cmdf);
            }

            if (updateArgs.DynamicMenuEnd)
            {
                return(VSErr.OLECMDERR_E_NOTSUPPORTED);
            }

            if (textQuery != TextQueryType.None && !string.IsNullOrEmpty(updateArgs.Text))
            {
                SetText(pCmdText, updateArgs.Text);
            }

            if (_customizeMode && updateArgs.Command != AnkhCommand.ForceUIShow)
            {
                prgCmds[0].cmdf = (uint)(cmdf & ~OLECMDF.OLECMDF_INVISIBLE);
            }
            else
            {
                prgCmds[0].cmdf = (uint)cmdf;
            }

            return(0); // S_OK
        }
Example #3
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context, object argument, bool promptUser, bool dontPromptUser)
     : this(command, context)
 {
     _argument = argument;
     _promptUser = promptUser;
     _dontPromptUser = dontPromptUser;
 }
Example #4
0
        static Version GetUIVersion(AnkhContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            IAnkhPackage pkg = context.GetService <IAnkhPackage>();

            if (pkg != null)
            {
                return(pkg.UIVersion);
            }

            return(GetCurrentVersion(context));
        }
Example #5
0
        void TestAllCommands()
        {
            AnkhContext context = AnkhContext.Create(sp);

            foreach (AnkhCommand command in Enum.GetValues(typeof(AnkhCommand)))
            {
                var e = new CommandUpdateEventArgs(command, context);

                cm.PerformUpdate(command, e);
            }

            foreach (AnkhCommandMenu m in Enum.GetValues(typeof(AnkhCommandMenu)))
            {
                var e = new CommandUpdateEventArgs((AnkhCommand)m, context);

                cm.PerformUpdate((AnkhCommand)m, e);
            }
        }
Example #6
0
        public int QueryStatus(AnkhContext context, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
        {
            if (context == null)
                throw new ArgumentNullException("context");
            else if (cCmds != 1 || prgCmds == null)
                return -1;

            TextQueryType textQuery = TextQueryType.None;

            if (pCmdText != IntPtr.Zero)
            {
                // VS Want's some text from us for either the statusbar or the command text
                OLECMDTEXTF textType = GetFlags(pCmdText);

                switch (textType)
                {
                    case OLECMDTEXTF.OLECMDTEXTF_NAME:
                        textQuery = TextQueryType.Name;
                        break;
                    case OLECMDTEXTF.OLECMDTEXTF_STATUS:
                        textQuery = TextQueryType.Status;
                        break;
                }
            }

            CommandUpdateEventArgs updateArgs = new CommandUpdateEventArgs((AnkhCommand)prgCmds[0].cmdID, context, textQuery);

            OLECMDF cmdf = OLECMDF.OLECMDF_SUPPORTED;

            if (PerformUpdate(updateArgs.Command, updateArgs))
            {
                updateArgs.UpdateFlags(ref cmdf);
            }

            if (updateArgs.DynamicMenuEnd)
                return (int)OLEConstants.OLECMDERR_E_NOTSUPPORTED;

            if (textQuery != TextQueryType.None && !string.IsNullOrEmpty(updateArgs.Text))
            {
                SetText(pCmdText, updateArgs.Text);
            }

            if (_customizeMode && updateArgs.Command != AnkhCommand.ForceUIShow)
                prgCmds[0].cmdf = (uint)(cmdf & ~OLECMDF.OLECMDF_INVISIBLE);
            else
                prgCmds[0].cmdf = (uint)cmdf;

            return 0; // S_OK
        }
Example #7
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context)
     : base(command, context)
 {
 }
Example #8
0
 public BaseCommandEventArgs(AnkhCommand command, AnkhContext context)
 {
     _command = command;
     _context = context;
 }
Example #9
0
 public CommandUpdateEventArgs(AnkhCommand command, AnkhContext context, TextQueryType textQuery)
     : this(command, context)
 {
     _queryType = textQuery;
 }
        private bool SetIssueRepositoryProperties(AnkhContext context, SvnItem item, IssueRepositorySettings settings)
        {
            return context.GetService<IProgressRunner>().RunModal("Applying Issue Repository settings",
                delegate(object sender, ProgressWorkerArgs wa)
                {
                    wa.Client.SetProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryConnector, settings.ConnectorName);
                    wa.Client.SetProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryUri, settings.RepositoryUri.ToString());
                    string repositoryId = settings.RepositoryId;
                    if (string.IsNullOrEmpty(repositoryId))
                    {
                        wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryId);
                    }
                    else
                    {
                        wa.Client.SetProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryId, settings.RepositoryId);
                    }
                    IDictionary<string, object> customProperties = settings.CustomProperties;
                    if (customProperties == null
                        || customProperties.Count == 0
                        )
                    {
                        wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyNames);
                        wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyValues);
                    }
                    else
                    {
                        string[] propNameArray = new string[customProperties.Keys.Count];
                        customProperties.Keys.CopyTo(propNameArray, 0);
                        string propNames = string.Join(",", propNameArray);

                        List<string> propValueList = new List<string>();
                        foreach (string propName in propNameArray)
                        {
                            object propValue;
                            if (!customProperties.TryGetValue(propName, out propValue))
                            {
                                propValue = string.Empty;
                            }
                            propValueList.Add(propValue == null ? string.Empty : propValue.ToString());
                        }
                        string propValues = string.Join(",", propValueList.ToArray());
                        wa.Client.SetProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyNames, propNames);
                        wa.Client.SetProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyValues, propValues);
                    }

                }).Succeeded;
        }
 private bool DeleteIssueRepositoryProperties(AnkhContext context, SvnItem item)
 {
     return context.GetService<IProgressRunner>().RunModal("Removing Issue Repository settings",
         delegate(object sender, ProgressWorkerArgs wa)
         {
             wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryConnector);
             wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryUri);
             wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryId);
             wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyNames);
             wa.Client.DeleteProperty(item.FullPath, AnkhSccPropertyNames.IssueRepositoryPropertyValues);
         }).Succeeded;
 }
Example #12
0
 public CommandEventArgs(AnkhCommand command, AnkhContext context)
     : base(command, context)
 {
 }
Example #13
0
        static Version GetUIVersion(AnkhContext context)
        {
            if (context == null)
                throw new ArgumentNullException("context");

            IAnkhPackage pkg = context.GetService<IAnkhPackage>();

            if (pkg != null)
                return pkg.UIVersion;

            return GetCurrentVersion(context);
        }
Example #14
0
 public CommandUpdateEventArgs(AnkhCommand command, AnkhContext context, TextQueryType textQuery)
     : this(command, context)
 {
     _queryType = textQuery;
 }