Пример #1
0
 void OnStop(object s, EventArgs args)
 {
     addressLines.Clear();
     currentFile = null;
     if (messageOverlayWindow != null)
     {
         messageOverlayWindow.Destroy();
         messageOverlayWindow = null;
     }
     sw.Sensitive         = false;
     autoRefill           = false;
     editor.Document.Text = string.Empty;
     cachedLines.Clear();
 }
Пример #2
0
        public void Update()
        {
            autoRefill = false;

            editor.Document.RemoveMarker(currentDebugLineMarker);

            if (DebuggingService.CurrentFrame == null)
            {
                if (messageOverlayWindow != null)
                {
                    messageOverlayWindow.Destroy();
                    messageOverlayWindow = null;
                }
                sw.Sensitive = false;
                return;
            }

            sw.Sensitive = true;
            var sf = DebuggingService.CurrentFrame;

            if (!string.IsNullOrWhiteSpace(sf.SourceLocation.FileName) && sf.SourceLocation.Line != -1 && sf.SourceLocation.FileHash != null)
            {
                ShowLoadSourceFile(sf);
            }
            else
            {
                if (messageOverlayWindow != null)
                {
                    messageOverlayWindow.Destroy();
                    messageOverlayWindow = null;
                }
            }
            if (!string.IsNullOrEmpty(sf.SourceLocation.FileName) && File.Exists(sf.SourceLocation.FileName))
            {
                FillWithSource();
            }
            else
            {
                Fill();
            }
        }
Пример #3
0
		void ShowLoadSourceFile (StackFrame sf)
		{
			if (messageOverlayWindow != null) {
				messageOverlayWindow.Destroy ();
				messageOverlayWindow = null;
			}
			messageOverlayWindow = new OverlayMessageWindow ();

			var hbox = new HBox ();
			hbox.Spacing = 8;
			var label = new Label (string.Format ("{0} not found. Find source file at alternative location.", Path.GetFileName (sf.SourceLocation.FileName)));
			hbox.TooltipText = sf.SourceLocation.FileName;
			var color = (HslColor)editor.ColorStyle.NotificationText.Foreground;
			label.ModifyFg (StateType.Normal, color);

			int w, h;
			label.Layout.GetPixelSize (out w, out h);

			hbox.PackStart (label, true, true, 0);
			var openButton = new Button (Gtk.Stock.Open);
			openButton.WidthRequest = 60;
			hbox.PackEnd (openButton, false, false, 0); 

			var container = new HBox ();
			const int containerPadding = 8;
			container.PackStart (hbox, true, true, containerPadding); 
			messageOverlayWindow.Child = container; 
			messageOverlayWindow.ShowOverlay (editor);

			messageOverlayWindow.SizeFunc = () => openButton.SizeRequest ().Width + w + hbox.Spacing * 5 + containerPadding * 2;
			openButton.Clicked += delegate {
				var dlg = new OpenFileDialog (GettextCatalog.GetString ("File to Open"), SelectFileDialogAction.Open) {
					TransientFor = IdeApp.Workbench.RootWindow,
					ShowEncodingSelector = true,
					ShowViewerSelector = true
				};
				if (!dlg.Run ())
					return;
				var newFilePath = dlg.SelectedFile;
				try {
					if (File.Exists (newFilePath)) {
						if (SourceCodeLookup.CheckFileMd5 (newFilePath, sf.SourceLocation.FileHash)) {
							SourceCodeLookup.AddLoadedFile (newFilePath, sf.SourceLocation.FileName);
							sf.UpdateSourceFile (newFilePath);
							if (IdeApp.Workbench.OpenDocument (newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null) {
								this.WorkbenchWindow.CloseWindow (false);
							}
						} else {
							MessageService.ShowWarning ("File checksum doesn't match.");
						}
					} else {
						MessageService.ShowWarning ("File not found.");
					}
				} catch (Exception) {
					MessageService.ShowWarning ("Error opening file");
				}
			};
		}
Пример #4
0
		void OnStop (object s, EventArgs args)
		{
			addressLines.Clear ();
			currentFile = null;
			if (messageOverlayWindow != null) {
				messageOverlayWindow.Destroy ();
				messageOverlayWindow = null;
			}
			sw.Sensitive = false;
			autoRefill = false;
			editor.Document.Text = string.Empty;
			cachedLines.Clear ();
		}
Пример #5
0
		public void Update ()
		{
			autoRefill = false;
			
			editor.Document.RemoveMarker (currentDebugLineMarker);
			
			if (DebuggingService.CurrentFrame == null) {
				if (messageOverlayWindow != null) {
					messageOverlayWindow.Destroy ();
					messageOverlayWindow = null;
				}
				sw.Sensitive = false;
				return;
			}
			
			sw.Sensitive = true;
			var sf = DebuggingService.CurrentFrame;
			if (!string.IsNullOrWhiteSpace (sf.SourceLocation.FileName) && sf.SourceLocation.Line != -1 && sf.SourceLocation.FileHash != null) {
				ShowLoadSourceFile (sf);
			} else {
				if (messageOverlayWindow != null) {
					messageOverlayWindow.Destroy ();
					messageOverlayWindow = null;
				}
			}
			if (!string.IsNullOrEmpty (sf.SourceLocation.FileName) && File.Exists (sf.SourceLocation.FileName))
				FillWithSource ();
			else
				Fill ();
		}
Пример #6
0
        void ShowLoadSourceFile(StackFrame sf)
        {
            if (messageOverlayWindow != null)
            {
                messageOverlayWindow.Destroy();
                messageOverlayWindow = null;
            }
            messageOverlayWindow = new OverlayMessageWindow();

            var hbox = new HBox();

            hbox.Spacing = 8;
            var label = new Label(string.Format("{0} not found. Find source file at alternative location.", Path.GetFileName(sf.SourceLocation.FileName)));

            hbox.TooltipText = sf.SourceLocation.FileName;
            var color = (HslColor)editor.ColorStyle.NotificationText.Foreground;

            label.ModifyFg(StateType.Normal, color);

            int w, h;

            label.Layout.GetPixelSize(out w, out h);

            hbox.PackStart(label, true, true, 0);
            var openButton = new Button(Gtk.Stock.Open);

            openButton.WidthRequest = 60;
            hbox.PackEnd(openButton, false, false, 0);

            var       container        = new HBox();
            const int containerPadding = 8;

            container.PackStart(hbox, true, true, containerPadding);
            messageOverlayWindow.Child = container;
            messageOverlayWindow.ShowOverlay(editor);

            messageOverlayWindow.SizeFunc = () => openButton.SizeRequest().Width + w + hbox.Spacing * 5 + containerPadding * 2;
            openButton.Clicked           += delegate {
                var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), Gtk.FileChooserAction.Open)
                {
                    TransientFor         = IdeApp.Workbench.RootWindow,
                    ShowEncodingSelector = true,
                    ShowViewerSelector   = true
                };
                if (!dlg.Run())
                {
                    return;
                }
                var newFilePath = dlg.SelectedFile;
                try {
                    if (File.Exists(newFilePath))
                    {
                        if (SourceCodeLookup.CheckFileMd5(newFilePath, sf.SourceLocation.FileHash))
                        {
                            SourceCodeLookup.AddLoadedFile(newFilePath, sf.SourceLocation.FileName);
                            sf.UpdateSourceFile(newFilePath);
                            if (IdeApp.Workbench.OpenDocument(newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null)
                            {
                                this.WorkbenchWindow.CloseWindow(false);
                            }
                        }
                        else
                        {
                            MessageService.ShowWarning("File checksum doesn't match.");
                        }
                    }
                    else
                    {
                        MessageService.ShowWarning("File not found.");
                    }
                } catch (Exception) {
                    MessageService.ShowWarning("Error opening file");
                }
            };
        }