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(); }
public void ActivateItem(int n) { var textEditor = (MonoTextEditor)box.Tag; if (n == 0) { box.SetItem(GettextCatalog.GetString("Local"), null, new object()); widget.SetLocal(textEditor.GetTextEditorData()); return; } widget.RemoveLocal(textEditor.GetTextEditorData()); textEditor.Document.IsReadOnly = true; if (n == 1) { box.SetItem(GettextCatalog.GetString("Base"), null, new object()); if (textEditor == widget.editors[0]) { widget.diffRevision = null; } else { widget.originalRevision = null; } Task.Run(async() => { try { return(await widget.info.Item.Repository.GetBaseTextAsync(widget.info.Item.Path)); } catch (Exception ex) { var text = string.Format(GettextCatalog.GetString("Error while getting the base text of {0}:\n{1}"), widget.info.Item.Path, ex.ToString()); await Runtime.RunInMainThread(() => MessageService.ShowError(text)); return(text); } }).ContinueWith(t => { var editor = (MonoTextEditor)box.Tag; if (editor.IsDisposed) { return; } editor.Document.Text = t.Result; widget.CreateDiff(); }, Runtime.MainTaskScheduler); return; } Revision rev = widget.info.History[n - 2]; widget.SetRevision(textEditor, rev); }
public DiffView(VersionControlDocumentInfo info, Revision baseRev, Revision toRev) : base(GettextCatalog.GetString("Changes")) { this.info = info; widget = new DiffWidget(info); ComparisonWidget.OriginalEditor.Document.MimeType = ComparisonWidget.DiffEditor.Document.MimeType = info.Document.Editor.Document.MimeType; ComparisonWidget.OriginalEditor.Options.FontName = ComparisonWidget.DiffEditor.Options.FontName = info.Document.Editor.Options.FontName; ComparisonWidget.OriginalEditor.Options.ColorScheme = ComparisonWidget.DiffEditor.Options.ColorScheme = info.Document.Editor.Options.ColorScheme; ComparisonWidget.OriginalEditor.Options.ShowFoldMargin = ComparisonWidget.DiffEditor.Options.ShowFoldMargin = false; ComparisonWidget.OriginalEditor.Options.ShowIconMargin = ComparisonWidget.DiffEditor.Options.ShowIconMargin = false; ComparisonWidget.SetRevision(ComparisonWidget.DiffEditor, baseRev); ComparisonWidget.SetRevision(ComparisonWidget.OriginalEditor, toRev); widget.ShowAll(); }
public void ActivateItem(int n) { if (n == 0) { box.SetItem("Local", null, new object()); widget.SetLocal(((TextEditor)box.Tag).GetTextEditorData()); return; } widget.RemoveLocal(((TextEditor)box.Tag).GetTextEditorData()); ((TextEditor)box.Tag).Document.ReadOnly = true; if (n == 1) { box.SetItem("Base", null, new object()); if (((TextEditor)box.Tag) == widget.editors[0]) { widget.diffRevision = null; } else { widget.originalRevision = null; } string text; try { text = widget.info.Item.Repository.GetBaseText(widget.info.Item.Path); } catch (Exception ex) { text = string.Format(GettextCatalog.GetString("Error while getting the base text of {0}:\n{1}"), widget.info.Item.Path, ex.ToString()); MessageService.ShowError(text); } ((TextEditor)box.Tag).Document.Text = text; widget.CreateDiff(); return; } Revision rev = widget.info.History[n - 2]; widget.SetRevision((TextEditor)box.Tag, rev); }