[Monodevelop-patches-list] r1139 - in trunk/MonoDevelop/src/Main/Base: Commands/ProjectBrowserCommands Gui/Dialogs

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Wed Mar 10 14:24:05 EST 2004


Author: tberman
Date: 2004-03-10 14:24:04 -0500 (Wed, 10 Mar 2004)
New Revision: 1139

Modified:
   trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewProjectDialog.cs
Log:
bugfix for #54726 from metaphaze.


Modified: trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs	2004-03-10 16:40:55 UTC (rev 1138)
+++ trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/CombineNodeCommands.cs	2004-03-10 19:24:04 UTC (rev 1139)
@@ -38,8 +38,10 @@
 			CombineBrowserNode node    = browser.SelectedNode as CombineBrowserNode;
 			
 			if (node != null) {
-				NewProjectDialog npdlg = new NewProjectDialog(false);
-				if (npdlg.Run() == (int)Gtk.ResponseType.Ok) {
+				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)));
 					projectService.SaveCombine();
 				}

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewProjectDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewProjectDialog.cs	2004-03-10 16:40:55 UTC (rev 1138)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewProjectDialog.cs	2004-03-10 19:24:04 UTC (rev 1139)
@@ -196,13 +196,35 @@
 			string solution = txt_subdirectory.Text;
 			string name     = txt_name.Text;
 			string location = entry_location.Path;
+
+			IProjectService projService = (IProjectService)ServiceManager.Services.GetService(typeof(IProjectService));			
+						
+			if(solution.Equals("")) solution = name; //This was empty when adding after first combine
+			
+			//The one below seemed to be failing sometimes.
+			if(solution.IndexOfAny("$#@!%^&*/?\\|'\";:}{".ToCharArray()) > -1) {
+				messageService.ShowError("Illegal project name. \nOnly use letters, digits, space, '.' or '_'.");
+				dialog.Respond(Gtk.ResponseType.Reject);
+				dialog.Hide();
+				return;
+			}
+
 			if ((solution != null && solution.Trim () != "" 
 				&& (!fileUtilityService.IsValidFileName (solution) || solution.IndexOf(System.IO.Path.DirectorySeparatorChar) >= 0)) ||
 			    !fileUtilityService.IsValidFileName(name)     || name.IndexOf(System.IO.Path.DirectorySeparatorChar) >= 0 ||
 			    !fileUtilityService.IsValidFileName(location)) {
 				messageService.ShowError("Illegal project name.\nOnly use letters, digits, space, '.' or '_'.");
+				dialog.Respond(Gtk.ResponseType.Reject);
+				dialog.Hide();
 				return;
 			}
+
+			if(projService.ExistsEntryWithName(name)) {
+				messageService.ShowError("A Project with that name is already in your Project Space");
+				dialog.Respond(Gtk.ResponseType.Reject);
+				dialog.Hide();
+				return;
+			}
 			
 			propertyService.SetProperty (
 				"MonoDevelop.Gui.Dialogs.NewProjectDialog.AutoCreateProjectSubdir",
@@ -234,6 +256,7 @@
 					NewProjectLocation = System.IO.Path.ChangeExtension(NewCombineLocation, ".prjx");
 					
 					//DialogResult = DialogResult.OK;
+					dialog.Respond(Gtk.ResponseType.Ok);
 					dialog.Hide ();
 
 #if false // from .98




More information about the Monodevelop-patches-list mailing list