Beispiel #1
0
		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);
			};
		}
Beispiel #2
0
        public PatchWidget(ComparisonView comparisonView, VersionControlDocumentInfo info)
        {
            this.Build();
            diffEditor = new Mono.TextEditor.TextEditor();
            diffEditor.Document.MimeType        = "text/x-diff";
            diffEditor.Options.FontName         = info.Document.TextEditorData.Options.FontName;
            diffEditor.Options.ColorScheme      = info.Document.TextEditorData.Options.ColorScheme;
            diffEditor.Options.ShowFoldMargin   = false;
            diffEditor.Options.ShowIconMargin   = false;
            diffEditor.Options.ShowTabs         = true;
            diffEditor.Options.ShowSpaces       = true;
            diffEditor.Options.ShowInvalidLines = info.Document.TextEditorData.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);
            };
        }
 public static void Show(VersionControlItemList items)
 {
     foreach (VersionControlItem item in items)
     {
         var document = IdeApp.Workbench.OpenDocument(item.Path);
         ComparisonView.AttachViewContents(document, item);
         document.Window.SwitchView(3);
     }
 }
Beispiel #4
0
        public static void AttachViewContents(Document document, VersionControlItem item)
        {
            IWorkbenchWindow window = document.Window;

            if (window.SubViewContents.Any(sub => sub is ComparisonView))
            {
                return;
            }

            VersionControlDocumentInfo info = new VersionControlDocumentInfo(document, item);

            ComparisonView comparisonView = new ComparisonView(info);

            window.AttachViewContent(comparisonView);
            window.AttachViewContent(new PatchView(comparisonView, info));
            window.AttachViewContent(new BlameView(info));
            window.AttachViewContent(new LogView(info));

            info.Start();
        }
Beispiel #5
0
		public static void AttachViewContents (Document document, VersionControlItem item)
		{
			IWorkbenchWindow window = document.Window;
			if (window.SubViewContents.Any (sub => sub is ComparisonView))
				return;
			
			VersionControlDocumentInfo info = new VersionControlDocumentInfo (document, item);
			
			ComparisonView comparisonView = new ComparisonView (info);
			window.AttachViewContent (comparisonView);
			window.AttachViewContent (new PatchView (comparisonView, info));
			window.AttachViewContent (new BlameView (info));
			window.AttachViewContent (new LogView (info));
			
			info.Start ();
		}
Beispiel #6
0
 public PatchView(ComparisonView comparisonView, VersionControlDocumentInfo info) : base("Diff")
 {
     widget = new PatchWidget(comparisonView, info);
 }