[Monodevelop-patches-list] r2476 - trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Mon Apr 25 16:36:07 EDT 2005


Author: lluis
Date: 2005-04-25 16:36:07 -0400 (Mon, 25 Apr 2005)
New Revision: 2476

Modified:
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am
   trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml
Log:
2005-04-25  Lluis Sanchez Gual  <lluis at novell.com>

	* DebuggingService.cs: Dispose the output pad when the debug session
	ends. The Run method now takes a progress monitor and will stop if
	the monitor notifies a cancel request. The Run method is now also
	responsible of creating the output pad.
	
	* DebuggerCommands.cs:
	* MonoDevelopDebugger.addin.xml: Use the new syntax for defining
	commands. The DebugProject and DebugKillApplication commands have
	been moved to MonoDevelop.Base since may they be reused by other addins.



Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog	2005-04-25 20:35:47 UTC (rev 2475)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog	2005-04-25 20:36:07 UTC (rev 2476)
@@ -1,3 +1,15 @@
+2005-04-25  Lluis Sanchez Gual  <lluis at novell.com>
+
+	* DebuggingService.cs: Dispose the output pad when the debug session
+	ends. The Run method now takes a progress monitor and will stop if
+	the monitor notifies a cancel request. The Run method is now also
+	responsible of creating the output pad.
+	
+	* DebuggerCommands.cs:
+	* MonoDevelopDebugger.addin.xml: Use the new syntax for defining
+	commands. The DebugProject and DebugKillApplication commands have
+	been moved to MonoDevelop.Base since may they be reused by other addins.
+
 2005-04-19  Chris Toshok  <toshok at ximian.com>
 
 	* Visualizers/TargetObjectProvider.cs: remove unnecessary using

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs	2005-04-25 20:35:47 UTC (rev 2475)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggerCommands.cs	2005-04-25 20:36:07 UTC (rev 2476)
@@ -3,65 +3,60 @@
 using MonoDevelop.Core.AddIns.Codons;
 using MonoDevelop.Services;
 using MonoDevelop.Core.Services;
+using MonoDevelop.Commands;
 
-namespace MonoDevelop.Debugger.Commands
+
+namespace MonoDevelop.Debugger
 {
+	public enum DebugCommands
+	{
+		ToggleRunning,
+		StepOver,
+		StepInto
+	}
+}
 
-	public class ToggleRunning : AbstractMenuCommand
+namespace MonoDevelop.Debugger.Commands
+{
+	public class ToggleRunning : CommandHandler
 	{
-		public override void Run ()
+		protected override void Run ()
 		{
 			if (Runtime.DebuggingService.IsRunning)
 				Runtime.DebuggingService.Pause ();
 			else
 				Runtime.DebuggingService.Resume ();
 		}
-	}
-
-	public class KillApplication : AbstractMenuCommand
-	{
-		public override void Run ()
+		
+		protected override void Update (CommandInfo info)
 		{
-			Runtime.DebuggingService.Stop();
+			info.Enabled = ((DebuggingService)Runtime.DebuggingService).Debugging;
 		}
 	}
 
-	public class StepOver : AbstractMenuCommand
+	public class StepOver : CommandHandler
 	{
-		public override void Run ()
+		protected override void Run ()
 		{
 			Runtime.DebuggingService.StepOver();
 		}
+		
+		protected override void Update (CommandInfo info)
+		{
+			info.Enabled = ((DebuggingService)Runtime.DebuggingService).Debugging;
+		}
 	}
 
-	public class StepInto : AbstractMenuCommand
+	public class StepInto : CommandHandler
 	{
-		public override void Run ()
+		protected override void Run ()
 		{
 			Runtime.DebuggingService.StepInto();
 		}
-	}
-
-	public class DebugProject : AbstractMenuCommand
-	{
-
-		public override void Run ()
+		
+		protected override void Update (CommandInfo info)
 		{
-			DebuggingService dbgr = (DebuggingService)Runtime.DebuggingService;
-			
-			if (Runtime.ProjectService.CurrentOpenCombine != null) {
-				if (Runtime.ProjectService.NeedsCompiling) {
-					Runtime.ProjectService.BuildActiveCombine ().WaitForCompleted ();
-				}
-#if NET_2_0
-				dbgr.AttributeHandler.Rescan();
-#endif
-
-				Runtime.ProjectService.CurrentOpenCombine.Debug (dbgr.DebugProgressMonitor);
-			}
-
+			info.Enabled = ((DebuggingService)Runtime.DebuggingService).Debugging;
 		}
-
 	}
-
 }

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs	2005-04-25 20:35:47 UTC (rev 2475)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs	2005-04-25 20:36:07 UTC (rev 2476)
@@ -54,6 +54,7 @@
 				StoppedEvent (this, new EventArgs ());
 			backend.Dispose ();
 			backend = null;
+			current_monitor.Dispose ();
 			current_monitor = null;
 #if NET_2_0
 			attr_handler = null;
@@ -75,19 +76,17 @@
 		}
 #endif
 
-		public IProgressMonitor DebugProgressMonitor {
-			get {
-				if (current_monitor != null)
-					return current_monitor;
+		public void CreateDebugConsole ()
+		{
+			if (current_monitor != null)
+				return;
 
-				current_monitor = Runtime.TaskService.GetOutputProgressMonitor ("Debug Output",
-									MonoDevelop.Gui.Stock.OutputIcon,
-									true, true);
-				return current_monitor;
-			}
-                }
+			current_monitor = Runtime.TaskService.GetOutputProgressMonitor ("Debug Output",
+								MonoDevelop.Gui.Stock.OutputIcon,
+								true, true);
+		}
 
-		private bool Debugging {
+		public bool Debugging {
 			get {
 				return backend != null && proc != null && proc.HasTarget;
 			}
@@ -299,17 +298,29 @@
 			proc.Continue (false);
 		}
 
-		public void Run (string[] argv)
+		public void Run (IProgressMonitor monitor, string[] argv)
 		{
 			if (Debugging)
 				return;
 
+#if NET_2_0
+			AttributeHandler.Rescan();
+#endif
+			CreateDebugConsole ();
+
 			backend = new DebuggerBackend ();
 			backend.ThreadManager.InitializedEvent += new ThreadEventHandler (initialized_event);
 			backend.ThreadManager.ThreadCreatedEvent += new ThreadEventHandler (thread_created);
 			backend.ThreadManager.ThreadExitedEvent += new ThreadEventHandler (thread_exited);
 			backend.Run (new ProcessStart (null, argv));
+			
+			monitor.CancelRequested += new MonitorHandler (OnCancelRequested);
 		}
+		
+		void OnCancelRequested (IProgressMonitor monitor)
+		{
+			Stop ();
+		}
 
 		public void Stop ()
 		{

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am	2005-04-25 20:35:47 UTC (rev 2475)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am	2005-04-25 20:36:07 UTC (rev 2476)
@@ -6,6 +6,7 @@
 DLLS = $(GTK_SHARP_LIBS) \
 	$(MONO_DEBUGGER_LIBS) \
 	/r:$(top_builddir)/build/bin/MonoDevelop.Base.dll \
+	/r:$(top_builddir)/build/bin/MonoDevelop.Gui.Widgets.dll \
 	/r:$(top_builddir)/build/bin/MonoDevelop.Core.dll \
         /r:$(top_builddir)/build/bin/ICSharpCode.SharpRefactory.dll
 

Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml	2005-04-25 20:35:47 UTC (rev 2475)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml	2005-04-25 20:36:07 UTC (rev 2476)
@@ -26,39 +26,30 @@
 		<ContextPad id = "MonoDevelop.Debugger.ThreadPad" />
 	</Extension>
 
-	<Extension path="/SharpDevelop/Workbench/MainMenu/Run">
-		<MenuItem id = "DebugProject"
-		          _label = "Debug Project"
-		          insertafter = "Run"
-		          shortcut = "Control|F5"
-		          class = "MonoDevelop.Debugger.Commands.DebugProject"/>
-	</Extension>
-
-	<Extension path="/SharpDevelop/Workbench/MainMenu">
-		<Conditional action = "Exclude" context = "Debug">
-			<MenuItem id = "DebugMenuThing" _label = "Debug" insertafter = "View" insertbefore = "Tools">
-					<MenuItem id = "ToggleRunning"
-						  _label = "Pause/Resume"
-						  shortcut = "Control|F8"
-						  class = "MonoDevelop.Debugger.Commands.ToggleRunning"/>
-	
-					<MenuItem id = "DebugKillApplication"
-						  _label = "Kill Application"
-						  class = "MonoDevelop.Debugger.Commands.KillApplication"/>
+	<Extension path = "/SharpDevelop/Commands">
+		<Command id = "MonoDevelop.Debugger.DebugCommands.ToggleRunning"
+				defaultHandler = "MonoDevelop.Debugger.Commands.ToggleRunning"
+				_label = "Pause/Resume"
+				shortcut = "Control|F8" />
 		
-					<MenuItem id = "DebugSep1" _label = "-" />
+		<Command id = "MonoDevelop.Debugger.DebugCommands.StepOver"
+				defaultHandler = "MonoDevelop.Debugger.Commands.StepOver"
+				_label = "Step Over"
+				shortcut = "F11" />
 		
-					<MenuItem id = "DebugStepOver"
-						  _label = "Step Over"
-					          shortcut = "F11"
-						  class = "MonoDevelop.Debugger.Commands.StepOver"/>
-		
-					<MenuItem id = "DebugStepInto"
-					          _label = "Step Into"
-					          shortcut = "Control|F11"
-					          class = "MonoDevelop.Debugger.Commands.StepInto"/>
-			</MenuItem>
-		</Conditional>
+		<Command id = "MonoDevelop.Debugger.DebugCommands.StepInto"
+				defaultHandler = "MonoDevelop.Debugger.Commands.StepInto"
+				_label = "Step Into"
+				shortcut = "Control|F11" />
 	</Extension>
+	
+
+
+	<Extension path="/SharpDevelop/Workbench/MainMenu/Run">
+		<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ToggleRunning" insertafter="MonoDevelop.Commands.ProjectCommands.Stop"/>
+		<SeparatorItem id = "DebugSep1" />
+		<CommandItem id = "MonoDevelop.Debugger.DebugCommands.StepOver" />
+		<CommandItem id = "MonoDevelop.Debugger.DebugCommands.StepInto" />
+	</Extension>
 </AddIn>
 




More information about the Monodevelop-patches-list mailing list