Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Context != null)
            {
                IAnkhConfigurationService config = Context.GetService <IAnkhConfigurationService>();

                _items = config.GetRecentLogMessages();

                logMessageList.Items.Clear();

                foreach (string i in _items)
                {
                    if (string.IsNullOrEmpty(i))
                    {
                        continue;
                    }

                    ListViewItem item = new ListViewItem();

                    item.Text = i.Trim().Replace("\r", "").Replace("\n", "\x23CE");
                    item.Tag  = i;
                    logMessageList.Items.Add(i);
                }
            }
        }
Example #2
0
        public void OnExecute(CommandEventArgs e)
        {
            IAnkhSolutionSettings slnSettings = e.GetService <IAnkhSolutionSettings>();
            List <ISvnLogItem>    logItems    = new List <ISvnLogItem>(e.Selection.GetSelection <ISvnLogItem>());

            if (logItems.Count != 1)
            {
                return;
            }

            using (EditLogMessageDialog dialog = new EditLogMessageDialog())
            {
                dialog.Context    = e.Context;
                dialog.LogMessage = logItems[0].LogMessage;

                if (dialog.ShowDialog(e.Context) == DialogResult.OK)
                {
                    if (dialog.LogMessage == logItems[0].LogMessage)
                    {
                        return; // No changes
                    }
                    IAnkhConfigurationService config = e.GetService <IAnkhConfigurationService>();

                    if (config != null)
                    {
                        if (dialog.LogMessage != null && dialog.LogMessage.Trim().Length > 0)
                        {
                            config.GetRecentLogMessages().Add(dialog.LogMessage);
                        }
                    }

                    using (SvnClient client = e.GetService <ISvnClientPool>().GetClient())
                    {
                        SvnSetRevisionPropertyArgs sa = new SvnSetRevisionPropertyArgs();
                        sa.AddExpectedError(SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE);
                        client.SetRevisionProperty(logItems[0].RepositoryRoot, logItems[0].Revision, SvnPropertyNames.SvnLog, dialog.LogMessage, sa);

                        if (sa.LastException != null &&
                            sa.LastException.SvnErrorCode == SvnErrorCode.SVN_ERR_REPOS_DISABLED_FEATURE)
                        {
                            AnkhMessageBox mb = new AnkhMessageBox(e.Context);

                            mb.Show(sa.LastException.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            return;
                        }
                    }

                    ILogControl logWindow = e.Selection.GetActiveControl <ILogControl>();

                    if (logWindow != null)
                    {
                        // TODO: Somehow repair scroll position/number of items loaded
                        logWindow.Restart();
                    }
                }
            }
        }