本文整理汇总了C#中ChangeSet.GenerateGlobalComment方法的典型用法代码示例。如果您正苦于以下问题:C# ChangeSet.GenerateGlobalComment方法的具体用法?C# ChangeSet.GenerateGlobalComment怎么用?C# ChangeSet.GenerateGlobalComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ChangeSet
的用法示例。
在下文中一共展示了ChangeSet.GenerateGlobalComment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommitDialog
public CommitDialog (ChangeSet changeSet)
{
Build ();
store = new ListStore(typeof (Xwt.Drawing.Image), typeof (string), typeof (string), typeof(bool), typeof(object));
fileList.Model = store;
this.changeSet = changeSet;
oldMessage = changeSet.GlobalComment;
CellRendererText crt = new CellRendererText ();
var crp = new CellRendererImage ();
TreeViewColumn colStatus = new TreeViewColumn ();
colStatus.Title = GettextCatalog.GetString ("Status");
colStatus.PackStart (crp, false);
colStatus.PackStart (crt, true);
colStatus.Spacing = 2;
colStatus.AddAttribute (crp, "image", 0);
colStatus.AddAttribute (crt, "text", 1);
CellRendererToggle cellToggle = new CellRendererToggle();
cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
TreeViewColumn colCommit = new TreeViewColumn ("", cellToggle, "active", 3);
TreeViewColumn colFile = new TreeViewColumn (GettextCatalog.GetString ("File"), new CellRendererText(), "text", 2);
fileList.AppendColumn(colCommit);
fileList.AppendColumn(colStatus);
fileList.AppendColumn(colFile);
colCommit.Visible = false;
object[] exts = AddinManager.GetExtensionObjects ("/MonoDevelop/VersionControl/CommitDialogExtensions", false);
bool separatorRequired = false;
foreach (object ob in exts) {
CommitDialogExtension ext = ob as CommitDialogExtension;
if (ext == null) {
MessageService.ShowError ("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension");
continue;
}
if (ext.Initialize (changeSet)) {
ext.CommitMessageTextViewHook (textview);
if (separatorRequired) {
HSeparator sep = new HSeparator ();
sep.Show ();
vboxExtensions.PackEnd (sep, false, false, 0);
}
vboxExtensions.PackEnd (ext, false, false, 0);
extensions.Add (ext);
ext.AllowCommitChanged += HandleAllowCommitChanged;
separatorRequired = true;
} else
ext.Destroy ();
}
HandleAllowCommitChanged (null, null);
foreach (ChangeSetItem info in changeSet.Items) {
Xwt.Drawing.Image statusicon = VersionControlService.LoadIconForStatus (info.Status);
string lstatus = VersionControlService.GetStatusLabel (info.Status);
string localpath;
if (info.IsDirectory)
localpath = (!info.LocalPath.IsChildPathOf (changeSet.BaseLocalPath)?
".":
(string) info.LocalPath.ToRelative (changeSet.BaseLocalPath));
else
localpath = System.IO.Path.GetFileName((string) info.LocalPath);
if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar) localpath = localpath.Substring(1);
if (localpath == "") { localpath = "."; } // not sure if this happens
store.AppendValues (statusicon, lstatus, localpath, true, info);
selected.Add (info.LocalPath);
}
if (string.IsNullOrEmpty (changeSet.GlobalComment)) {
AuthorInformation aInfo;
CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat (changeSet, out aInfo);
Message = changeSet.GenerateGlobalComment (fmt, aInfo);
}
else
Message = changeSet.GlobalComment;
textview.Buffer.Changed += OnTextChanged;
responseSensitive = !string.IsNullOrEmpty (Message);
// Focus the text view and move the insert point to the beginning. Makes it easier to insert
// a comment header.
textview.Buffer.MoveMark (textview.Buffer.InsertMark, textview.Buffer.StartIter);
textview.Buffer.MoveMark (textview.Buffer.SelectionBound, textview.Buffer.StartIter);
textview.GrabFocus ();
textview.Buffer.MarkSet += OnMarkSet;
SetResponseSensitive (ResponseType.Ok, responseSensitive);
}
示例2: CommitDialog
public CommitDialog (ChangeSet changeSet)
{
Build ();
store = new ListStore(typeof (Gdk.Pixbuf), typeof (string), typeof (string), typeof(bool), typeof(object));
fileList.Model = store;
this.changeSet = changeSet;
oldMessage = changeSet.GlobalComment;
CellRendererText crt = new CellRendererText ();
var crp = new CellRendererPixbuf ();
TreeViewColumn colStatus = new TreeViewColumn ();
colStatus.Title = GettextCatalog.GetString ("Status");
colStatus.PackStart (crp, false);
colStatus.PackStart (crt, true);
colStatus.Spacing = 2;
colStatus.AddAttribute (crp, "pixbuf", 0);
colStatus.AddAttribute (crt, "text", 1);
CellRendererToggle cellToggle = new CellRendererToggle();
cellToggle.Toggled += new ToggledHandler(OnCommitToggledHandler);
TreeViewColumn colCommit = new TreeViewColumn ("", cellToggle, "active", 3);
TreeViewColumn colFile = new TreeViewColumn (GettextCatalog.GetString ("File"), new CellRendererText(), "text", 2);
fileList.AppendColumn(colCommit);
fileList.AppendColumn(colStatus);
fileList.AppendColumn(colFile);
colCommit.Visible = false;
object[] exts = AddinManager.GetExtensionObjects ("/MonoDevelop/VersionControl/CommitDialogExtensions", false);
foreach (object ob in exts) {
CommitDialogExtension ext = ob as CommitDialogExtension;
if (ext == null) {
MessageService.ShowError ("Commit extension type " + ob.GetType() + " must be a subclass of CommitDialogExtension");
continue;
}
vboxExtensions.PackEnd (ext, false, false, 0);
ext.Initialize (changeSet);
extensions.Add (ext);
ext.AllowCommitChanged += HandleAllowCommitChanged;
}
HandleAllowCommitChanged (null, null);
foreach (ChangeSetItem info in changeSet.Items) {
Gdk.Pixbuf statusicon = VersionControlService.LoadIconForStatus (info.Status);
string lstatus = VersionControlService.GetStatusLabel (info.Status);
string localpath = (!info.LocalPath.IsChildPathOf (changeSet.BaseLocalPath)?
".":
(string) info.LocalPath.ToRelative (changeSet.BaseLocalPath));
if (localpath.Length > 0 && localpath[0] == System.IO.Path.DirectorySeparatorChar) localpath = localpath.Substring(1);
if (localpath == "") { localpath = "."; } // not sure if this happens
store.AppendValues (statusicon, lstatus, localpath, true, info);
selected.Add (info.LocalPath);
}
if (changeSet.GlobalComment.Length == 0) {
AuthorInformation aInfo;
CommitMessageFormat fmt = VersionControlService.GetCommitMessageFormat (changeSet, out aInfo);
Message = changeSet.GenerateGlobalComment (fmt, aInfo);
}
else
Message = changeSet.GlobalComment;
textview.Buffer.Changed += OnTextChanged;
}