本文整理汇总了C#中MonoDevelop.VersionControl.Views.VersionControlDocumentInfo类的典型用法代码示例。如果您正苦于以下问题:C# VersionControlDocumentInfo类的具体用法?C# VersionControlDocumentInfo怎么用?C# VersionControlDocumentInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VersionControlDocumentInfo类属于MonoDevelop.VersionControl.Views命名空间,在下文中一共展示了VersionControlDocumentInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load (VersionControlDocumentInfo info)
{
base.info = info;
// SetLocal calls create diff & sets UpdateDiff handler -> should be connected after diff is created
SetLocal (MainEditor.GetTextEditorData ());
Show ();
}
示例2: DiffWidget
public DiffWidget (VersionControlDocumentInfo info)
{
this.info = info;
this.Build ();
fixed1.SetSizeRequest (16, 16);
this.buttonNext.Clicked += (sender, args) => ComparisonWidget.GotoNext ();
this.buttonPrev.Clicked += (sender, args) => ComparisonWidget.GotoPrev ();
notebook1.Page = 0;
comparisonWidget.DiffChanged += delegate {
labelOverview.Markup = "<big>" + LabelText + "</big>";
SetButtonSensitivity ();
};
comparisonWidget.SetVersionControlInfo (info);
this.buttonDiff.Clicked += HandleButtonDiffhandleClicked;
diffTextEditor = new global::Mono.TextEditor.TextEditor ();
diffTextEditor.Document.MimeType = "text/x-diff";
diffTextEditor.Options.FontName = info.Document.Editor.Options.FontName;
diffTextEditor.Options.ColorScheme = info.Document.Editor.Options.ColorScheme;
diffTextEditor.Options.ShowFoldMargin = false;
diffTextEditor.Options.ShowIconMargin = false;
diffTextEditor.Options.ShowTabs = info.Document.Editor.Options.ShowTabs;
diffTextEditor.Options.ShowSpaces = info.Document.Editor.Options.ShowSpaces;
diffTextEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines;
diffTextEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines;
diffTextEditor.Document.ReadOnly = true;
scrolledwindow1.Child = diffTextEditor;
diffTextEditor.Show ();
SetButtonSensitivity ();
}
示例3: DiffWidget
public DiffWidget (VersionControlDocumentInfo info, bool viewOnly)
{
this.info = info;
this.Build ();
comparisonWidget = new MonoDevelop.VersionControl.Views.ComparisonWidget (viewOnly);
fixed1.SetSizeRequest (16, 16);
this.buttonNext.Clicked += (sender, args) => ComparisonWidget.GotoNext ();
this.buttonPrev.Clicked += (sender, args) => ComparisonWidget.GotoPrev ();
notebook1.Page = 0;
vboxComparisonView.PackStart (comparisonWidget, true, true, 0);
comparisonWidget.Show ();
comparisonWidget.DiffChanged += delegate {
labelOverview.Markup = LabelText;
SetButtonSensitivity ();
};
comparisonWidget.SetVersionControlInfo (info);
this.buttonDiff.Clicked += HandleButtonDiffhandleClicked;
diffTextEditor = new global::Mono.TextEditor.TextEditor (new Mono.TextEditor.Document (), new CommonTextEditorOptions ());
diffTextEditor.Document.MimeType = "text/x-diff";
diffTextEditor.Options.ShowFoldMargin = false;
diffTextEditor.Options.ShowIconMargin = false;
diffTextEditor.Document.ReadOnly = true;
scrolledwindow1.Child = diffTextEditor;
diffTextEditor.Show ();
SetButtonSensitivity ();
}
示例4: PatchWidget
public PatchWidget (ComparisonView comparisonView, VersionControlDocumentInfo info)
{
this.Build ();
diffEditor = new Mono.TextEditor.TextEditor ();
diffEditor.Document.MimeType = "text/x-diff";
diffEditor.Options.FontName = info.Document.Editor.Options.FontName;
diffEditor.Options.ColorScheme = info.Document.Editor.Options.ColorScheme;
diffEditor.Options.ShowFoldMargin = false;
diffEditor.Options.ShowIconMargin = false;
diffEditor.Options.ShowTabs = true;
diffEditor.Options.ShowSpaces = true;
diffEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines;
diffEditor.Document.ReadOnly = true;
scrolledwindow1.Child = diffEditor;
diffEditor.ShowAll ();
using (var writer = new StringWriter ()) {
UnifiedDiff.WriteUnifiedDiff (comparisonView.Diff, writer,
System.IO.Path.GetFileName (info.Item.Path) + " (repository)",
System.IO.Path.GetFileName (info.Item.Path) + " (working copy)",
3);
diffEditor.Document.Text = writer.ToString ();
}
buttonSave.Clicked += delegate {
var dlg = new OpenFileDialog (GettextCatalog.GetString ("Save as..."), FileChooserAction.Save) {
TransientFor = IdeApp.Workbench.RootWindow
};
if (!dlg.Run ())
return;
File.WriteAllText (dlg.SelectedFile, diffEditor.Document.Text);
};
}
示例5: TryAttachView
static void TryAttachView (Document document, VersionControlDocumentInfo info, string type)
{
var handler = AddinManager.GetExtensionObjects<IVersionControlViewHandler> (type)
.FirstOrDefault (h => h.CanHandle (info.Item, info.Document));
if (handler != null)
document.Window.AttachViewContent (handler.CreateView (info));
}
示例6: DiffWidget
public DiffWidget (VersionControlDocumentInfo info, bool viewOnly = false)
{
this.info = info;
this.Build ();
comparisonWidget = new ComparisonWidget (viewOnly);
buttonNext = new DocumentToolButton (Gtk.Stock.GoUp, GettextCatalog.GetString ("Previous Change"));
buttonPrev = new DocumentToolButton (Gtk.Stock.GoDown, GettextCatalog.GetString ("Next Change"));
labelOverview = new Gtk.Label () { Xalign = 0 };
buttonDiff = new Gtk.Button (GettextCatalog.GetString ("Unified Diff"));
this.buttonNext.Clicked += (sender, args) => ComparisonWidget.GotoNext ();
this.buttonPrev.Clicked += (sender, args) => ComparisonWidget.GotoPrev ();
notebook1.Page = 0;
vboxComparisonView.PackStart (comparisonWidget, true, true, 0);
comparisonWidget.Show ();
comparisonWidget.DiffChanged += delegate {
labelOverview.Markup = LabelText;
SetButtonSensitivity ();
};
comparisonWidget.SetVersionControlInfo (info);
this.buttonDiff.Clicked += HandleButtonDiffhandleClicked;
diffTextEditor = new global::Mono.TextEditor.MonoTextEditor (new Mono.TextEditor.TextDocument (), CommonTextEditorOptions.Instance);
diffTextEditor.Document.MimeType = "text/x-diff";
diffTextEditor.Options.ShowFoldMargin = false;
diffTextEditor.Options.ShowIconMargin = false;
diffTextEditor.Options.DrawIndentationMarkers = PropertyService.Get ("DrawIndentationMarkers", false);
diffTextEditor.Document.ReadOnly = true;
scrolledwindow1.Child = diffTextEditor;
diffTextEditor.Show ();
SetButtonSensitivity ();
}
示例7: DiffView
public DiffView (VersionControlDocumentInfo info, Revision baseRev, Revision toRev) : base (GettextCatalog.GetString ("Changes"))
{
this.info = info;
widget = new DiffWidget (info);
ComparisonWidget.SetRevision (ComparisonWidget.DiffEditor, baseRev);
ComparisonWidget.SetRevision (ComparisonWidget.OriginalEditor, toRev);
widget.ShowAll ();
}
示例8: DiffWidget
public DiffWidget (VersionControlDocumentInfo info, bool viewOnly)
{
this.info = info;
this.Build ();
comparisonWidget = new MonoDevelop.VersionControl.Views.ComparisonWidget (viewOnly);
fixed1.SetSizeRequest (16, 16);
this.buttonNext.Clicked += (sender, args) => ComparisonWidget.GotoNext ();
this.buttonPrev.Clicked += (sender, args) => ComparisonWidget.GotoPrev ();
notebook1.Page = 0;
vboxComparisonView.PackStart (comparisonWidget, true, true, 0);
comparisonWidget.Show ();
comparisonWidget.DiffChanged += delegate {
labelOverview.Markup = "<big>" + LabelText + "</big>";
SetButtonSensitivity ();
};
comparisonWidget.SetVersionControlInfo (info);
this.buttonDiff.Clicked += HandleButtonDiffhandleClicked;
diffTextEditor = new global::Mono.TextEditor.TextEditor ();
diffTextEditor.Document.MimeType = "text/x-diff";
if (info.Document != null) {
diffTextEditor.Options.FontName = info.Document.Editor.Options.FontName;
diffTextEditor.Options.ColorScheme = info.Document.Editor.Options.ColorScheme;
diffTextEditor.Options.ShowTabs = info.Document.Editor.Options.ShowTabs;
diffTextEditor.Options.ShowSpaces = info.Document.Editor.Options.ShowSpaces;
diffTextEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines;
diffTextEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines;
} else {
var options = MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance;
diffTextEditor.Options.FontName = options.FontName;
diffTextEditor.Options.ColorScheme = options.ColorScheme;
diffTextEditor.Options.ShowTabs = options.ShowTabs;
diffTextEditor.Options.ShowSpaces = options.ShowSpaces;
diffTextEditor.Options.ShowInvalidLines = options.ShowInvalidLines;
diffTextEditor.Options.ShowInvalidLines = options.ShowInvalidLines;
}
diffTextEditor.Options.ShowFoldMargin = false;
diffTextEditor.Options.ShowIconMargin = false;
diffTextEditor.Document.ReadOnly = true;
scrolledwindow1.Child = diffTextEditor;
diffTextEditor.Show ();
SetButtonSensitivity ();
}
示例9: Show
public static void Show (VersionControlItemList items, Revision since)
{
foreach (VersionControlItem item in items) {
if (!item.IsDirectory) {
var document = IdeApp.Workbench.OpenDocument (item.Path, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null) {
DiffView.AttachViewContents (document, item);
document.Window.SwitchView (document.Window.FindView (typeof(LogView)));
} else {
VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
LogView logView = new LogView (info);
info.Document = IdeApp.Workbench.OpenDocument (logView, true);
logView.Selected ();
}
} else if (item.VersionInfo.CanLog) {
new Worker (item.Repository, item.Path, item.IsDirectory, since).Start ();
}
}
}
示例10: LogView
public LogView (string filepath, bool isDirectory, Revision [] history, Repository vc)
: base (Path.GetFileName (filepath) + " Log")
{
try {
this.vinfo = vc.GetVersionInfo (filepath, VersionInfoQueryFlags.IgnoreCache);
}
catch (Exception ex) {
MessageService.ShowError (GettextCatalog.GetString ("Version control command failed."), ex);
}
// Widget setup
VersionControlDocumentInfo info =new VersionControlDocumentInfo (null, null, vc);
info.History = history;
info.Item.VersionInfo = vinfo;
var lw = new LogWidget (info);
widget = lw;
lw.History = history;
}
示例11: Show
public static bool Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
foreach (var item in items) {
var document = IdeApp.Workbench.OpenDocument (item.Path, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null) {
document.Window.SwitchView (document.Window.FindView<ILogView> ());
} else {
VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
LogView logView = new LogView (info);
info.Document = IdeApp.Workbench.OpenDocument (logView, true).PrimaryView;
logView.Selected ();
}
}
return true;
}
示例12: HandleDocumentChanged
static void HandleDocumentChanged (object sender, EventArgs e)
{
var document = Ide.IdeApp.Workbench.ActiveDocument;
try {
if (document == null || !document.IsFile || document.Window.FindView<ILogView> () >= 0)
return;
WorkspaceObject project = document.Project;
if (project == null) {
// Fix for broken .csproj and .sln files not being seen as having a project.
foreach (var projItem in Ide.IdeApp.Workspace.GetAllItems<UnknownSolutionItem> ()) {
if (projItem.FileName == document.FileName) {
project = projItem;
}
}
if (project == null)
return;
}
var repo = VersionControlService.GetRepository (project);
if (repo == null)
return;
var versionInfo = repo.GetVersionInfo (document.FileName, VersionInfoQueryFlags.IgnoreCache);
if (!versionInfo.IsVersioned)
return;
var item = new VersionControlItem (repo, project, document.FileName, false, null);
var vcInfo = new VersionControlDocumentInfo (document.PrimaryView, item, item.Repository);
TryAttachView (document, vcInfo, DiffCommand.DiffViewHandlers);
TryAttachView (document, vcInfo, BlameCommand.BlameViewHandlers);
TryAttachView (document, vcInfo, LogCommand.LogViewHandlers);
TryAttachView (document, vcInfo, MergeCommand.MergeViewHandlers);
} catch (Exception ex) {
// If a user is hitting this, it will show a dialog box every time they
// switch to a document or open a document, so suppress the crash dialog
// This bug *should* be fixed already, but it's hard to tell.
LoggingService.LogInternalError (ex);
}
}
示例13: Show
public static async Task<bool> Show (VersionControlItemList items, bool test)
{
if (test)
return items.All (CanShow);
foreach (var item in items) {
Document document = null;
if (!item.IsDirectory)
document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer);
if (document != null) {
document.Window.SwitchView (document.Window.FindView<ILogView> ());
} else {
VersionControlDocumentInfo info = new VersionControlDocumentInfo (null, item, item.Repository);
LogView logView = new LogView (info);
info.Document = IdeApp.Workbench.OpenDocument (logView, true).PrimaryView;
logView.Init ();
}
}
return true;
}
示例14: LogWidget
public LogWidget (VersionControlDocumentInfo info)
{
this.Build ();
this.info = info;
if (info.Document != null)
this.preselectFile = info.Document.FileName;
revertButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert changes from this revision"));
revertButton.IsImportant = true;
// revertButton.Sensitive = false;
revertButton.Clicked += new EventHandler (RevertRevisionClicked);
CommandBar.Insert (revertButton, -1);
revertToButton = new Gtk.ToolButton (new Gtk.Image ("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString ("Revert to this revision"));
revertToButton.IsImportant = true;
// revertToButton.Sensitive = false;
revertToButton.Clicked += new EventHandler (RevertToRevisionClicked);
CommandBar.Insert (revertToButton, -1);
Gtk.ToolItem item = new Gtk.ToolItem ();
Gtk.HBox a = new Gtk.HBox ();
item.Add (a);
searchEntry = new SearchEntry ();
searchEntry.WidthRequest = 200;
searchEntry.ForceFilterButtonVisible = true;
searchEntry.EmptyMessage = GettextCatalog.GetString ("Search");
searchEntry.Changed += HandleSearchEntryFilterChanged;
searchEntry.Ready = true;
searchEntry.Show ();
a.PackEnd (searchEntry, false, false, 0);
CommandBar.Insert (item, -1);
((Gtk.Toolbar.ToolbarChild)CommandBar[item]).Expand = true;
CommandBar.ShowAll ();
messageRenderer.Ellipsize = Pango.EllipsizeMode.End;
TreeViewColumn colRevMessage = new TreeViewColumn ();
colRevMessage.Title = GettextCatalog.GetString ("Message");
var graphRenderer = new RevisionGraphCellRenderer ();
colRevMessage.PackStart (graphRenderer, false);
colRevMessage.SetCellDataFunc (graphRenderer, GraphFunc);
colRevMessage.PackStart (messageRenderer, true);
colRevMessage.SetCellDataFunc (messageRenderer, MessageFunc);
colRevMessage.Sizing = TreeViewColumnSizing.Autosize;
treeviewLog.AppendColumn (colRevMessage);
colRevMessage.MinWidth = 350;
colRevMessage.Resizable = true;
TreeViewColumn colRevDate = new TreeViewColumn (GettextCatalog.GetString ("Date"), textRenderer);
colRevDate.SetCellDataFunc (textRenderer, DateFunc);
colRevDate.Resizable = true;
treeviewLog.AppendColumn (colRevDate);
TreeViewColumn colRevAuthor = new TreeViewColumn ();
colRevAuthor.Title = GettextCatalog.GetString ("Author");
colRevAuthor.PackStart (pixRenderer, false);
colRevAuthor.PackStart (textRenderer, true);
colRevAuthor.SetCellDataFunc (textRenderer, AuthorFunc);
colRevAuthor.SetCellDataFunc (pixRenderer, AuthorIconFunc);
colRevAuthor.Resizable = true;
treeviewLog.AppendColumn (colRevAuthor);
TreeViewColumn colRevNum = new TreeViewColumn (GettextCatalog.GetString ("Revision"), textRenderer);
colRevNum.SetCellDataFunc (textRenderer, RevisionFunc);
colRevNum.Resizable = true;
treeviewLog.AppendColumn (colRevNum);
treeviewLog.Model = logstore;
treeviewLog.Selection.Changed += TreeSelectionChanged;
treeviewFiles = new FileTreeView ();
treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated;
scrolledwindowFiles.Child = treeviewFiles;
scrolledwindowFiles.ShowAll ();
changedpathstore = new TreeStore (typeof(Gdk.Pixbuf), typeof (string), // icon/file name
typeof(Gdk.Pixbuf), typeof (string), // icon/operation
typeof (string), // path
typeof (string), // revision path (invisible)
typeof (string[]) // diff
);
TreeViewColumn colChangedFile = new TreeViewColumn ();
var crp = new CellRendererPixbuf ();
var crt = new CellRendererText ();
colChangedFile.Title = GettextCatalog.GetString ("File");
colChangedFile.PackStart (crp, false);
colChangedFile.PackStart (crt, true);
colChangedFile.AddAttribute (crp, "pixbuf", 2);
colChangedFile.AddAttribute (crt, "text", 3);
treeviewFiles.AppendColumn (colChangedFile);
TreeViewColumn colOperation = new TreeViewColumn ();
colOperation.Title = GettextCatalog.GetString ("Operation");
colOperation.PackStart (crp, false);
colOperation.PackStart (crt, true);
colOperation.AddAttribute (crp, "pixbuf", 0);
//.........这里部分代码省略.........
示例15: ComparisonWidget
public ComparisonWidget (VersionControlDocumentInfo info)
{
this.info = info;
vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
vAdjustment.Changed += HandleAdjustmentChanged;
leftVAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
Connect (leftVAdjustment, vAdjustment);
rightVAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
Connect (rightVAdjustment, vAdjustment);
vScrollBar = new VScrollbar (vAdjustment);
AddChild (vScrollBar);
vScrollBar.Hide ();
hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
hAdjustment.Changed += HandleAdjustmentChanged;
leftHAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
Connect (leftHAdjustment, hAdjustment);
rightHAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
Connect (rightHAdjustment, hAdjustment);
leftHScrollBar = new HScrollbar (hAdjustment);
AddChild (leftHScrollBar);
rightHScrollBar = new HScrollbar (hAdjustment);
AddChild (rightHScrollBar);
originalEditor = new TextEditor ();
originalEditor.Caret.PositionChanged += CaretPositionChanged;
originalEditor.FocusInEvent += EditorFocusIn;
AddChild (originalEditor);
originalEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
originalComboBox = new DropDownBox ();
originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
originalComboBox.Text = "Local";
originalComboBox.Tag = originalEditor;
AddChild (originalComboBox);
diffEditor = new TextEditor ();
diffEditor.Caret.PositionChanged += CaretPositionChanged;
diffEditor.FocusInEvent += EditorFocusIn;
AddChild (diffEditor);
diffEditor.Document.ReadOnly = true;
diffEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
this.vAdjustment.ValueChanged += delegate {
middleArea.QueueDraw ();
};
diffComboBox = new DropDownBox ();
diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
diffComboBox.Text = "Base";
diffComboBox.Tag = diffEditor;
AddChild (diffComboBox);
overview = new OverviewRenderer (this);
AddChild (overview);
middleArea = new MiddleArea (this);
AddChild (middleArea);
prev = new Button ();
prev.Add (new Arrow (ArrowType.Up, ShadowType.None));
AddChild (prev);
prev.ShowAll ();
prev.Clicked += delegate {
if (this.Diff == null)
return;
originalEditor.GrabFocus ();
int line = originalEditor.Caret.Line;
int max = -1, searched = -1;
foreach (Diff.Hunk hunk in this.Diff) {
if (hunk.Same)
continue;
max = System.Math.Max (hunk.Right.Start, max);
if (hunk.Right.Start < line)
searched = System.Math.Max (hunk.Right.Start, searched);
}
if (max >= 0) {
originalEditor.Caret.Line = searched < 0 ? max : searched;
originalEditor.CenterToCaret ();
}
};
next = new Button ();
next.BorderWidth = 0;
next.Add (new Arrow (ArrowType.Down, ShadowType.None));
next.Clicked += delegate {
if (this.Diff == null)
return;
originalEditor.GrabFocus ();
int line = originalEditor.Caret.Line;
int min = Int32.MaxValue, searched = Int32.MaxValue;
foreach (Diff.Hunk hunk in this.Diff) {
//.........这里部分代码省略.........