[Monodevelop-patches-list] r1401 - in trunk/MonoDevelop: data/resources src/AddIns/DebuggerAddIn src/Main/Base src/Main/Base/Gui/Components src/Main/Base/Gui/Workbench/Layouts src/Main/Base/Internal/Conditions

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Tue Apr 6 18:21:18 EDT 2004


Author: tberman
Date: 2004-04-06 18:21:18 -0400 (Tue, 06 Apr 2004)
New Revision: 1401

Added:
   trunk/MonoDevelop/src/Main/Base/Internal/Conditions/WorkbenchContextCondition.cs
Modified:
   trunk/MonoDevelop/data/resources/AddIn.xsd
   trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml
   trunk/MonoDevelop/src/Main/Base/ChangeLog
   trunk/MonoDevelop/src/Main/Base/Gui/Components/SdMenu.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
   trunk/MonoDevelop/src/Main/Base/Makefile.am
Log:
now you can set up menu items to be conditional on current context.

fix the debugger so its menu items are conditional based on context.


Modified: trunk/MonoDevelop/data/resources/AddIn.xsd
===================================================================
--- trunk/MonoDevelop/data/resources/AddIn.xsd	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/data/resources/AddIn.xsd	2004-04-06 22:21:18 UTC (rev 1401)
@@ -49,6 +49,7 @@
 		<xs:attribute name="openproject" type="xs:string" use="optional"/>
 		<xs:attribute name="textcontent" type="xs:string" use="optional"/>
 		<xs:attribute name="ownerstate" type="xs:string" use="optional"/>
+		<xs:attribute name="context" type="xs:string" use="optional"/>
 		<xs:attribute name="string" type="xs:string" use="optional"/>
 		<xs:attribute name="equals" type="xs:string" use="optional"/>
 		<xs:attribute name="action" use="optional">

Modified: trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml
===================================================================
--- trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/AddIns/DebuggerAddIn/MonoDevelopDebugger.addin.xml	2004-04-06 22:21:18 UTC (rev 1401)
@@ -19,34 +19,39 @@
 		       class = "MonoDevelop.SourceEditor.Gui.DebuggerLocalsPad"/>
 	</Extension>
 
+	<Extension path="/SharpDevelop/Workbench/MainMenu/Run">
+		<MenuItem id = "DebugProject"
+		          _label = "Debug Project"
+		          insertafter = "Run"
+		          shortcut = "Control|F5"
+		          class = "MonoDevelop.Commands.DebugProject"/>
+	</Extension>
+
 	<Extension path="/SharpDevelop/Workbench/MainMenu">
-		<MenuItem id = "DebugMenuThing" _label = "Debug" insertafter = "View" insertbefore = "Tools">
-			<MenuItem id = "DebugProject"
-	                          _label = "Debug Project"
-			          shortcut = "Control|F5"
-		                  class = "MonoDevelop.Commands.DebugProject"/>
-
-			<MenuItem id = "ToggleRunning"
-				  _label = "Pause/Resume"
-			          shortcut = "Control|F8"
-				  class = "MonoDevelop.Commands.ToggleRunning"/>
-
-			<MenuItem id = "DebugKillApplication"
-				  _label = "Kill Application"
-				  class = "MonoDevelop.Commands.KillApplication"/>
-
-			<MenuItem id = "DebugSep1" _label = "-" />
-
-			<MenuItem id = "DebugStepOver"
-				  _label = "Step Over"
-			          shortcut = "F11"
-				  class = "MonoDevelop.Commands.StepOver"/>
-
-			<MenuItem id = "DebugStepInto"
-			          _label = "Step Into"
-			          shortcut = "Control|F11"
-			          class = "MonoDevelop.Commands.StepInto"/>
-		</MenuItem>
+		<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.Commands.ToggleRunning"/>
+	
+					<MenuItem id = "DebugKillApplication"
+						  _label = "Kill Application"
+						  class = "MonoDevelop.Commands.KillApplication"/>
+		
+					<MenuItem id = "DebugSep1" _label = "-" />
+		
+					<MenuItem id = "DebugStepOver"
+						  _label = "Step Over"
+					          shortcut = "F11"
+						  class = "MonoDevelop.Commands.StepOver"/>
+		
+					<MenuItem id = "DebugStepInto"
+					          _label = "Step Into"
+					          shortcut = "Control|F11"
+					          class = "MonoDevelop.Commands.StepInto"/>
+			</MenuItem>
+		</Conditional>
 	</Extension>
-</AddIn>
+</AddIn	>
 

Modified: trunk/MonoDevelop/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Main/Base/ChangeLog	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/Main/Base/ChangeLog	2004-04-06 22:21:18 UTC (rev 1401)
@@ -1,5 +1,14 @@
 2004-04-06  Todd Berman  <tberman at sevenl.net>
 
+	* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs: update the menu
+	after a context switch.
+	* Gui/Components/SdMenu.cs: remove some junk.
+	* Internal/Conditions/WorkbenchContextCondition.cs: new condition
+	to allow conditionals on current context state.
+	* Makefile.am: add above file to build
+
+2004-04-06  Todd Berman  <tberman at sevenl.net>
+
 	* Commands/ProjectBrowserCommands/CombineNodeCommands.cs: fix bug
 	#56429.
 

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Components/SdMenu.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Components/SdMenu.cs	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Components/SdMenu.cs	2004-04-06 22:21:18 UTC (rev 1401)
@@ -29,7 +29,7 @@
 		
 		ConditionCollection conditionCollection;
 		object caller;
-		string localizedText = String.Empty;
+		public string localizedText = String.Empty;
 		public ArrayList SubItems = new ArrayList();
 		private Gtk.Menu subMenu = null;
 		
@@ -66,12 +66,12 @@
 		
 		public void OnDropDown(object ob, System.EventArgs e)
 		{
-			foreach (object o in ((Gtk.Menu)Submenu).Children) {
-			
-				if (o is IStatusUpdate) {
-					((IStatusUpdate)o).UpdateStatus();
-				}
-			}
+			//foreach (object o in ((Gtk.Menu)Submenu).Children) {
+			//
+			//	if (o is IStatusUpdate) {
+			//		((IStatusUpdate)o).UpdateStatus();
+			//	}
+			//}
 			UpdateStatus ();
 		}
 		
@@ -105,7 +105,7 @@
 				ShowAll ();
 			}
 		}
-
+		
 		public void Append (Gtk.Widget item)
 		{
 			if (item.Parent == null) {

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2004-04-06 22:21:18 UTC (rev 1401)
@@ -141,6 +141,7 @@
 		void onContextChanged (object o, EventArgs e)
 		{
 			SwitchContext (workbench.Context);
+			workbench.UpdateMenu (null, null);
 		}
 
 		void SwitchContext (WorkbenchContext ctxt)

Added: trunk/MonoDevelop/src/Main/Base/Internal/Conditions/WorkbenchContextCondition.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Internal/Conditions/WorkbenchContextCondition.cs	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/Main/Base/Internal/Conditions/WorkbenchContextCondition.cs	2004-04-06 22:21:18 UTC (rev 1401)
@@ -0,0 +1,41 @@
+using System;
+using System.Xml;
+
+using MonoDevelop.Core.AddIns.Conditions;
+using MonoDevelop.Gui;
+
+namespace MonoDevelop.Core.AddIns
+{
+	[ConditionAttribute()]
+		public class WorkbenchContext : AbstractCondition
+	{
+		[XmlMemberAttribute("context", IsRequired = true)]
+			string context;
+
+		public string CurrentContext 
+		{
+			get 
+			{
+				return context;
+			}
+			set
+			{
+				context = value;
+			}
+		}
+
+		public override bool IsValid (object owner)
+		{
+			if (WorkbenchSingleton.Workbench == null)
+				return false;
+
+			if (context == "*")
+				return true;
+
+			if (context == WorkbenchSingleton.Workbench.Context.ToString ())
+				return true;
+
+			return false;
+		}
+	}
+}

Modified: trunk/MonoDevelop/src/Main/Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-04-06 22:01:07 UTC (rev 1400)
+++ trunk/MonoDevelop/src/Main/Base/Makefile.am	2004-04-06 22:21:18 UTC (rev 1401)
@@ -224,6 +224,7 @@
 ./Internal/Conditions/WindowOpenCondition.cs \
 ./Internal/Conditions/CombineOpenCondition.cs \
 ./Internal/Conditions/ProjectOpenCondition.cs \
+./Internal/Conditions/WorkbenchContextCondition.cs \
 ./Internal/Codons/DisplayBinding/IDisplayBinding.cs \
 ./Internal/Codons/DisplayBinding/ISubDisplayBinding.cs \
 ./Internal/Codons/DisplayBinding/DisplayBindingCodon.cs \




More information about the Monodevelop-patches-list mailing list