[Monodevelop-patches-list] r1160 - in trunk/MonoDevelop: . src/Main/Base/Commands/ProjectBrowserCommands

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Fri Mar 12 04:57:47 EST 2004


Author: jba
Date: 2004-03-12 04:57:47 -0500 (Fri, 12 Mar 2004)
New Revision: 1160

Modified:
   trunk/MonoDevelop/ChangeLog
   trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs
Log:
new project/combine node expanding love

Modified: trunk/MonoDevelop/ChangeLog
===================================================================
--- trunk/MonoDevelop/ChangeLog	2004-03-12 05:07:13 UTC (rev 1159)
+++ trunk/MonoDevelop/ChangeLog	2004-03-12 09:57:47 UTC (rev 1160)
@@ -1,3 +1,11 @@
+2004-03-05  John BouAntoun  <jba-mono at optusnet.com.au>
+	
+	* src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs:
+	Made it so adding any new nodes to projectbrowserview 
+	(i.e. adding new or existing projects or combines to it) expands
+	to the added nodes. bug #54725
+	Also fixed bug where could not add a new project to combine
+
 2004-03-11  John Luke  <jluke at cfl.rr.com>
 
 	* src/AddIns/DisplayBindings/SourceEditor/:

Modified: trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs	2004-03-12 05:07:13 UTC (rev 1159)
+++ trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs	2004-03-12 09:57:47 UTC (rev 1160)
@@ -38,14 +38,16 @@
 			CombineBrowserNode node    = browser.SelectedNode as CombineBrowserNode;
 			
 			if (node != null) {
-				NewProjectDialog npdlg;
-				int response;				
-				while( (response = (npdlg = new NewProjectDialog(false)).Run())  == (int)Gtk.ResponseType.Reject ) 				
-					if (response /*npdlg.Run()*/ == (int)Gtk.ResponseType.Ok) {
-					node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)node.Combine.AddEntry(npdlg.NewProjectLocation)));
+				NewProjectDialog npdlg = new NewProjectDialog(false);
+				if (npdlg.Run() == (int)Gtk.ResponseType.Ok) {
+					System.Console.WriteLine("inside if");
+					int newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)node.Combine.AddEntry(npdlg.NewProjectLocation)));
 					projectService.SaveCombine();
+					// expand to the new node
+					node.Nodes[newNodeIndex].Expand();
 				}
-			}
+			}			
+			System.Console.WriteLine("end");
 		}
 	}
 		
@@ -60,8 +62,11 @@
 			if (node != null) {
 				NewProjectDialog npdlg = new NewProjectDialog(false);
 				if (npdlg.Run() == (int)Gtk.ResponseType.Ok) {
-					node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)node.Combine.AddEntry(npdlg.NewCombineLocation)));
+					int newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)node.Combine.AddEntry(npdlg.NewCombineLocation)));
 					projectService.SaveCombine();
+					
+					// expand to the new node
+					node.Nodes[newNodeIndex].Expand();
 				}
 			}
 		}
@@ -74,19 +79,32 @@
 			IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
 			ProjectBrowserView browser = (ProjectBrowserView)Owner;
 			CombineBrowserNode node    = browser.SelectedNode as CombineBrowserNode;
+			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService (typeof (PropertyService));
 			
 			if (node != null) {
 				using (Gtk.FileSelection fdiag = new Gtk.FileSelection ("Add a Project")) {
 					StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
+					string defaultFolder = propertyService.GetProperty(
+						"MonoDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", 
+					System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
+						"MonoDevelopProjects")).ToString();
+					
+					fdiag.Complete (defaultFolder);
 					fdiag.SelectMultiple = false;
 					if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
 						object obj = node.Combine.AddEntry(fdiag.Filename);
+						int newNodeIndex = -1;
 						if (obj is IProject) {
-							node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
+							newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
 						} else {
-							node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
+							newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
 						}
 						projectService.SaveCombine();
+						
+						if (newNodeIndex > -1) {
+							// expand to the new node
+							node.Nodes[newNodeIndex].Expand();
+						}
 					}
 
 					fdiag.Hide ();
@@ -102,19 +120,33 @@
 			IProjectService projectService = (IProjectService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
 			ProjectBrowserView browser = (ProjectBrowserView)Owner;
 			CombineBrowserNode node    = browser.SelectedNode as CombineBrowserNode;
+			PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService (typeof (PropertyService));
 			
 			if (node != null) {
 				using (Gtk.FileSelection fdiag = new Gtk.FileSelection ("Add a Combine")) {
 					StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
+				
+					string defaultFolder = propertyService.GetProperty(
+						"MonoDevelop.Gui.Dialogs.NewProjectDialog.DefaultPath", 
+					System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
+						"MonoDevelopProjects")).ToString();
+					
+					fdiag.Complete (defaultFolder);
 					fdiag.SelectMultiple = false;
 					if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
 						object obj = node.Combine.AddEntry(fdiag.Filename);
+						int newNodeIndex = -1;
 						if (obj is IProject) {
-							node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
+							newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildProjectTreeNode((IProject)obj));
 						} else {
-							node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
+							newNodeIndex = node.Nodes.Add(ProjectBrowserView.BuildCombineTreeNode((Combine)obj));
 						}
 						projectService.SaveCombine();
+						
+						if (newNodeIndex > -1) {
+							// expand to the new node
+							node.Nodes[newNodeIndex].Expand();
+						}
 					}
 
 					fdiag.Hide ();




More information about the Monodevelop-patches-list mailing list