[Monodevelop-patches-list] r2638 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Commands Gui/Dialogs Gui/Pads Gui/Pads/HelpBrowser Gui/Pads/SolutionPad Gui/ToolWidgets Gui/Workbench Gui/Workbench/Layouts Internal/Project/Combine Internal/Project/Project Internal/Serialization Internal/Templates/ProjectTemplates

Lluis Sanchez <lluis@ximian.com> lluis at mono-cvs.ximian.com
Wed Jul 13 11:42:01 EDT 2005


Author: lluis
Date: 2005-07-13 11:42:01 -0400 (Wed, 13 Jul 2005)
New Revision: 2638

Added:
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs
Modified:
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/CombineOptionsDialog.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/HelpViewer.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeState.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/TerminalPad.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ToolWidgets/ConfigurationComboBox.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs
   trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
Log:
2005-07-13  Lluis Sanchez Gual  <lluis at novell.com> 

	* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs:
	* Gui/Workbench/Layouts/SdiWorkspaceWindow.cs:
	* Gui/Workbench/DefaultWorkbench.cs:
	* Commands/AutostartCommands.cs: Don't abuse ShowAll().
	
	* Gui/Dialogs/NewProjectDialog.cs: Use a default icon for the template
	if none is provided.
	
	* Gui/Dialogs/CombineOptionsDialog.cs:
	* Gui/Dialogs/ProjectOptionsDialog.cs: IConfiguration can't be renamed
	anymore, so to change the name, a copy has to be made.
	
	* Gui/Pads/SolutionPad/TreeViewPad.cs: ExpandToNode should not expand
	the current node, only the parents.
	
	* Gui/Pads/SolutionPad/NodeState.cs: Save/restore the selected node in the
	node state tree.
	
	* Gui/Pads/HelpBrowser/HelpViewer.cs:
	* Gui/Pads/HelpBrowser/MonodocTreePad.cs:
	* Gui/Pads/DefaultMonitorPad.cs:
	* Gui/Pads/TerminalPad.cs:
	* Gui/Pads/OpenTaskView.cs: The responsibility of showing the widgets of
	a pad is for the pad. The workbench won't ShowAll any more.
	
	* Gui/ToolWidgets/ConfigurationComboBox.cs: Update the combo when
	configurations are added or removed.
	
	* Internal/Project/Project/IConfiguration.cs: Don't allow renaming of
	configurations.
	
	* Internal/Project/Project/AbstractConfiguration.cs: Make Clone work
	for classes with no default constructor.
	
	* Internal/Project/Combine/Combine.cs: Ignore the
	ActiveConfigurationChanged event while deserializing.
	
	* Internal/Project/Combine/ConfigurationCollection.cs:
	* Internal/Project/Combine/CombineEntry.cs: Added ConfigurationAdded
	and ConfigurationRemoved events.
	
	* Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs:
	* Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs:
	* Internal/Templates/ProjectTemplates/CombineDescriptor.cs: 
	* Internal/Templates/ProjectTemplates/ProjectTemplate.cs:
	* Internal/Templates/ProjectTemplates/ProjectDescriptor.cs:
	Added template support for generic CombineEntry subclasses, which don't
	need to be Projects.



Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog	2005-07-13 15:42:01 UTC (rev 2638)
@@ -1,3 +1,54 @@
+2005-07-13  Lluis Sanchez Gual  <lluis at novell.com> 
+
+	* Gui/Workbench/Layouts/SdiWorkspaceLayout.cs:
+	* Gui/Workbench/Layouts/SdiWorkspaceWindow.cs:
+	* Gui/Workbench/DefaultWorkbench.cs:
+	* Commands/AutostartCommands.cs: Don't abuse ShowAll().
+	
+	* Gui/Dialogs/NewProjectDialog.cs: Use a default icon for the template
+	if none is provided.
+	
+	* Gui/Dialogs/CombineOptionsDialog.cs:
+	* Gui/Dialogs/ProjectOptionsDialog.cs: IConfiguration can't be renamed
+	anymore, so to change the name, a copy has to be made.
+	
+	* Gui/Pads/SolutionPad/TreeViewPad.cs: ExpandToNode should not expand
+	the current node, only the parents.
+	
+	* Gui/Pads/SolutionPad/NodeState.cs: Save/restore the selected node in the
+	node state tree.
+	
+	* Gui/Pads/HelpBrowser/HelpViewer.cs:
+	* Gui/Pads/HelpBrowser/MonodocTreePad.cs:
+	* Gui/Pads/DefaultMonitorPad.cs:
+	* Gui/Pads/TerminalPad.cs:
+	* Gui/Pads/OpenTaskView.cs: The responsibility of showing the widgets of
+	a pad is for the pad. The workbench won't ShowAll any more.
+	
+	* Gui/ToolWidgets/ConfigurationComboBox.cs: Update the combo when
+	configurations are added or removed.
+	
+	* Internal/Project/Project/IConfiguration.cs: Don't allow renaming of
+	configurations.
+	
+	* Internal/Project/Project/AbstractConfiguration.cs: Make Clone work
+	for classes with no default constructor.
+	
+	* Internal/Project/Combine/Combine.cs: Ignore the
+	ActiveConfigurationChanged event while deserializing.
+	
+	* Internal/Project/Combine/ConfigurationCollection.cs:
+	* Internal/Project/Combine/CombineEntry.cs: Added ConfigurationAdded
+	and ConfigurationRemoved events.
+	
+	* Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs:
+	* Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs:
+	* Internal/Templates/ProjectTemplates/CombineDescriptor.cs: 
+	* Internal/Templates/ProjectTemplates/ProjectTemplate.cs:
+	* Internal/Templates/ProjectTemplates/ProjectDescriptor.cs:
+	Added template support for generic CombineEntry subclasses, which don't
+	need to be Projects.
+
 2005-07-11  Lluis Sanchez Gual  <lluis at novell.com> 
 
 	* Services/File/IFileService.cs: 

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Commands/AutostartCommands.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -78,7 +78,7 @@
 				}
 			}
 			
-			((Gtk.Window)WorkbenchSingleton.Workbench).ShowAll ();
+			((Gtk.Window)WorkbenchSingleton.Workbench).Show ();
 			WorkbenchSingleton.Workbench.SetMemento ((IXmlConvertable)Runtime.Properties.GetProperty (workbenchMemento, WorkbenchSingleton.Workbench.CreateMemento()));
 			((Gtk.Window)WorkbenchSingleton.Workbench).Visible = true;
 			WorkbenchSingleton.Workbench.RedrawAllComponents ();

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/CombineOptionsDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/CombineOptionsDialog.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/CombineOptionsDialog.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -207,8 +207,14 @@
 		public void RenameConfiguration (string oldName, string newName, bool renameChildConfigurations)
 		{
 			IConfiguration cc = Configurations [oldName];
-			if (cc != null)
-				cc.Name = newName;
+			if (cc != null) {
+				IConfiguration nc = Entry.CreateConfiguration (newName);
+				nc.CopyFrom (cc);
+				Configurations.Remove (oldName);
+				Configurations.Add (nc);
+				if (ConfigurationsChanged != null)
+					ConfigurationsChanged (this, null);
+			}
 			if (renameChildConfigurations) {
 				foreach (ConfigurationData data in Children)
 					data.RenameConfiguration (oldName, newName, true);

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/NewProjectDialog.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -128,7 +128,9 @@
 			if (lst_template_types.Selection.GetSelected (out mdl, out iter)) {
 				TemplateView.Clear ();
 				foreach (TemplateItem item in ((Category)catStore.GetValue (iter, 1)).Templates) {
-					TemplateView.AddIcon (ResourceService.GetStockId (item.Template.Icon), Gtk.IconSize.Dnd, item.Name, item.Template);
+					string icon = item.Template.Icon;
+					if (icon == null) icon = "Icons.32x32.EmptyProjectIcon";
+					TemplateView.AddIcon (ResourceService.GetStockId (icon), Gtk.IconSize.Dnd, item.Name, item.Template);
 				}
 				
 				btn_new.Sensitive = false;

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Dialogs/ProjectOptionsDialog.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -124,8 +124,10 @@
 			} while (duplicateNumber);
 			
 			// append new configuration node to the configurationTreeNode
-			IConfiguration newConfig = (IConfiguration) project.ActiveConfiguration.Clone();
-			newConfig.Name = newName;			
+			
+			IConfiguration newConfig = project.CreateConfiguration (newName);
+			newConfig.CopyFrom (project.ActiveConfiguration);
+
 			Gtk.TreeIter newNode = treeStore.AppendValues (configurationTreeNode, newConfig.Name , newConfig);
 			
 			// add the config to the project
@@ -234,8 +236,13 @@
 			// set the new label
 			if (!duplicateLabel) {
 				IConfiguration config = (IConfiguration) treeStore.GetValue(iter, 1);
-				config.Name = newLabel;
-				treeStore.SetValue(iter, 1, config);
+				IConfiguration newc = project.CreateConfiguration (newLabel);
+				newc.CopyFrom (config);
+				
+				project.Configurations.Remove (config);
+				project.Configurations.Add (newc);
+				
+				treeStore.SetValue(iter, 1, newc);
 				treeStore.SetValue(iter, 0, newLabel);
 			}
 			

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/DefaultMonitorPad.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -88,6 +88,8 @@
 			this.title = title;
 			this.icon = icon;
 			this.markupTitle = title;
+			
+			Control.ShowAll ();
 		}
 
 		public IAsyncOperation AsyncOperation {

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/HelpViewer.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/HelpViewer.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/HelpViewer.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -37,6 +37,7 @@
 			html_viewer.UrlRequested += new UrlRequestedHandler (UrlRequested);
 			html_viewer.OnUrl += new OnUrlHandler (OnUrl);
 			scroller.Add (html_viewer);
+			Control.ShowAll ();
 		}
 
 		void OnUrl (object sender, OnUrlArgs args)

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/HelpBrowser/MonodocTreePad.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -55,6 +55,8 @@
 					goto start;
 				}
 			} while (store.IterNext (ref child_iter));
+			
+			Control.ShowAll ();
 		}
 
 		Hashtable populated = new Hashtable ();

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/OpenTaskView.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -91,6 +91,7 @@
 			Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineOpen));
 			Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));
 			view.RowActivated            += new RowActivatedHandler (OnRowActivated);
+			Control.ShowAll ();
 		}
 
 		[GLib.ConnectBefore]

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeState.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeState.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/NodeState.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -36,6 +36,7 @@
 	{
 		string NodeName;
 		bool Expanded;
+		bool Selected;
 		TreeViewPad.TreeOptions Options;
 		ArrayList ChildrenState;
 		
@@ -55,6 +56,8 @@
 			if (NodeName != null)
 				el.SetAttribute ("name", NodeName);
 			el.SetAttribute ("expanded", Expanded.ToString ());
+			if (Selected)
+				el.SetAttribute ("selected", "True");
 			
 			TreeViewPad.TreeOptions ops = Options;
 			if (ops != null) {
@@ -84,6 +87,7 @@
 			ns.NodeName = elem.GetAttribute ("name");
 			string expanded = elem.GetAttribute ("expanded");
 			ns.Expanded = (expanded == "" || bool.Parse (expanded));
+			ns.Selected = elem.GetAttribute ("selected") == "True";
 			
 			XmlNodeList nodelist = elem.ChildNodes;
 			foreach (XmlNode nod in nodelist) {
@@ -130,9 +134,11 @@
 			}
 			
 			TreeViewPad.TreeOptions ops = pad.GetIterOptions (it);
-			if (ops != null || nav.Expanded || childrenState != null) {
+			
+			if (ops != null || nav.Expanded || childrenState != null || nav.Selected) {
 				NodeState es = new NodeState ();
 				es.Expanded = nav.Expanded;
+				es.Selected = nav.Selected;
 				es.Options = ops;
 				es.ChildrenState = childrenState;
 				return es;
@@ -151,14 +157,17 @@
 			pad.ResetState (it);
 			nav.Expanded = es.Expanded;
 			
-			if (es.ChildrenState == null) return;
-			
-			foreach (NodeState ces in es.ChildrenState) {
-				if (nav.MoveToChild (ces.NodeName, null)) {
-					RestoreState (pad, nav, ces);
-					nav.MoveToParent ();
+			if (es.ChildrenState != null) {
+				foreach (NodeState ces in es.ChildrenState) {
+					if (nav.MoveToChild (ces.NodeName, null)) {
+						RestoreState (pad, nav, ces);
+						nav.MoveToParent ();
+					}
 				}
 			}
+			
+			if (es.Selected)
+				nav.Selected = true;
 		}
 	}
 }

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/SolutionPad/TreeViewPad.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -235,6 +235,8 @@
 			tree.DragMotion += new Gtk.DragMotionHandler (OnDragMotion);
 			
 			tree.CursorChanged += new EventHandler (OnSelectionChanged);
+			
+			contentPanel.ShowAll ();
 		}
 
 		void OnDragBegin (object o, Gtk.DragBeginArgs arg)
@@ -1153,7 +1155,7 @@
 							tree.ExpandRow (path, false);
 						}
 				
-//						tree.Selection.SelectIter (currentIter);
+						tree.Selection.SelectIter (currentIter);
 						tree.SetCursor (store.GetPath (currentIter), pad.complete_column, false);
 //						tree.ScrollToCell (store.GetPath (currentIter), null, false, 0, 0);
 					}
@@ -1338,8 +1340,11 @@
 			
 			public void ExpandToNode ()
 			{
-				Gtk.TreePath path = store.GetPath (currentIter);
-				tree.ExpandToPath (path);
+				Gtk.TreeIter it;
+				if (store.IterParent (out it, currentIter)) {
+					Gtk.TreePath path = store.GetPath (it);
+					tree.ExpandToPath (path);
+				}
 			}
 			
 			public string NodeName {

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/TerminalPad.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/TerminalPad.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Pads/TerminalPad.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -105,6 +105,8 @@
 			sw.Add (hbox);
 			frame.Add (sw);
 			
+			Control.ShowAll ();
+			
 /*			Runtime.TaskService.CompilerOutputChanged += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SetOutput));
 			projectService.StartBuild += (EventHandler) Runtime.DispatchService.GuiDispatch (new EventHandler (SelectMessageView));
 			projectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OnCombineClosed));

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ToolWidgets/ConfigurationComboBox.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ToolWidgets/ConfigurationComboBox.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/ToolWidgets/ConfigurationComboBox.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -36,6 +36,7 @@
 	{
 		Gtk.ComboBox combo;
 		ConfigurationEventHandler onActiveConfigurationChanged;
+		ConfigurationEventHandler onConfigurationsChanged;
 		
 		public ConfigurationComboBox (): base (0.5f, 0.5f, 1.0f, 0f)
 		{
@@ -45,7 +46,10 @@
 			combo.Changed += new EventHandler (OnChanged);
 			Add (combo);
 			ShowAll ();
+			
 			onActiveConfigurationChanged = (ConfigurationEventHandler) Runtime.DispatchService.GuiDispatch (new ConfigurationEventHandler (OnActiveConfigurationChanged));
+			onConfigurationsChanged = (ConfigurationEventHandler) Runtime.DispatchService.GuiDispatch (new ConfigurationEventHandler (OnConfigurationsChanged));
+			
 			Runtime.ProjectService.CombineOpened += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (OpenCombine));
 			Runtime.ProjectService.CombineClosed += (CombineEventHandler) Runtime.DispatchService.GuiDispatch (new CombineEventHandler (CloseCombine));
 			Reset ();
@@ -59,29 +63,43 @@
 			combo.Sensitive = false;
 		}
 		
-		void OpenCombine (object sender, CombineEventArgs e)
+		void RefreshCombo (Combine combine)
 		{
 			((Gtk.ListStore)combo.Model).Clear ();
 			combo.Sensitive = true;
 			int active = 0;
-			for (int n=0; n < e.Combine.Configurations.Count; n++) {
-				IConfiguration c = e.Combine.Configurations [n];
+			for (int n=0; n < combine.Configurations.Count; n++) {
+				IConfiguration c = combine.Configurations [n];
 				combo.AppendText (c.Name);
-				if (e.Combine.ActiveConfiguration == c)
+				if (combine.ActiveConfiguration == c)
 					active = n;
 			}
 			combo.Active = active;
 			combo.ShowAll ();
-			
+		}
+
+		void OpenCombine (object sender, CombineEventArgs e)
+		{
+			RefreshCombo (e.Combine);
 			e.Combine.ActiveConfigurationChanged += onActiveConfigurationChanged;
+			e.Combine.ConfigurationAdded += onConfigurationsChanged;
+			e.Combine.ConfigurationRemoved += onConfigurationsChanged;
 		}
 
 		void CloseCombine (object sender, CombineEventArgs e)
 		{
 			Reset ();
 			e.Combine.ActiveConfigurationChanged -= onActiveConfigurationChanged;
+			e.Combine.ConfigurationAdded -= onConfigurationsChanged;
+			e.Combine.ConfigurationRemoved -= onConfigurationsChanged;
 		}
 		
+		void OnConfigurationsChanged (object sender, ConfigurationEventArgs e)
+		{
+			Console.WriteLine ("combo OnConfigurationsChanged");
+			RefreshCombo (Runtime.ProjectService.CurrentOpenCombine);
+		}
+		
 		void OnActiveConfigurationChanged (object sender, ConfigurationEventArgs e)
 		{
 			Combine combine = (Combine) e.CombineEntry;

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/DefaultWorkbench.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -254,7 +254,6 @@
 			if (bringToFront)
 				content.WorkbenchWindow.SelectWindow();
 
-			ShowAll ();
 			RedrawAllComponents ();
 		}
 		

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -106,12 +106,13 @@
 			item.PreferredWidth = -2;
 			item.PreferredHeight = -2;
 			item.Add (tabControl);
-			item.ShowAll ();
+			item.Show ();
 			dock.AddItem (item, DockPlacement.Center);
 
 			workbench.Add (vbox);
 			
 			vbox.PackEnd (Runtime.Gui.StatusBar.Control, false, true, 0);
+			workbench.ShowAll ();
 			
 			foreach (IViewContent content in workbench.ViewContentCollection)
 				ShowView (content);
@@ -132,7 +133,7 @@
 			
 			CreateDefaultLayout();
 			//RedrawAllComponents();
-			wbWindow.ShowAll ();
+			wbWindow.Show ();
 
 			workbench.ContextChanged += contextChangedHandler;
 		}
@@ -371,16 +372,19 @@
 								 content.Title,
 								 content.Icon,
 								 DockItemBehavior.Normal);
-								 
+
 			Gtk.Label label = item.TabLabel as Gtk.Label;
 			label.UseMarkup = true;
 
 			if (content is Widget)
 				item.Add (content.Control);
-			else
-				item.Add (new CommandRouterContainer (content.Control, content, true));
+			else {
+				CommandRouterContainer crc = new CommandRouterContainer (content.Control, content, true);
+				crc.Show ();
+				item.Add (crc);
+			}
 				
-			item.ShowAll ();
+			item.Show ();
 			item.HideItem ();
 
 			content.TitleChanged += new EventHandler (UpdatePad);
@@ -411,6 +415,7 @@
 			}
 			else
 				dock.AddItem (item, dockPlacement);
+			item.Show ();
 		}
 		
 		void UpdatePad (object source, EventArgs args)
@@ -502,7 +507,7 @@
 			sdiWorkspaceWindow.CloseEvent += new EventHandler(CloseWindowEvent);
 			tabControl.InsertPage (sdiWorkspaceWindow, tabLabel, -1);
 		
-			tabControl.ShowAll();
+			tabLabel.Show();
 			return sdiWorkspaceWindow;
 		}
 

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -125,8 +125,8 @@
 			content.ContentChanged     += new EventHandler (OnContentChanged);
 			ShadowType = ShadowType.None;
 			Add (content.Control);
-			content.Control.ShowAll ();
-			ShowAll ();
+			content.Control.Show ();
+			Show ();
 			SetTitleEvent(null, null);
 
 			commandHandler = new ViewCommandHandlers (this);

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -51,6 +51,8 @@
 		[ProjectPathItemProperty ("outputpath")]
 		string outputdir     = null;
 		
+		bool deserializing;
+		
 		ProjectFileEventHandler fileAddedToProjectHandler;
 		ProjectFileEventHandler fileRemovedFromProjectHandler;
 		ProjectFileEventHandler fileChangedInProjectHandler;
@@ -160,9 +162,11 @@
 		
 		protected override void OnActiveConfigurationChanged (ConfigurationEventArgs args)
 		{
-			foreach (CombineConfigurationEntry cce in ((CombineConfiguration)ActiveConfiguration).Entries) {
-				IConfiguration conf = cce.Entry.GetConfiguration (cce.ConfigurationName);
-				cce.Entry.ActiveConfiguration = conf;
+			if (ActiveConfiguration != null && !deserializing) {
+				foreach (CombineConfigurationEntry cce in ((CombineConfiguration)ActiveConfiguration).Entries) {
+					IConfiguration conf = cce.Entry.GetConfiguration (cce.ConfigurationName);
+					cce.Entry.ActiveConfiguration = conf;
+				}
 			}
 			base.OnActiveConfigurationChanged  (args);
 		}
@@ -223,13 +227,23 @@
 		
 		public override void Deserialize (ITypeSerializer handler, DataCollection data)
 		{
-			base.Deserialize (handler, data);
-
-			foreach (CombineExecuteDefinition ced in combineExecuteDefinitions)
-				ced.SetCombine (this);
-			
-			foreach (CombineConfiguration conf in Configurations)
-				conf.SetCombine (this);
+			try {
+				deserializing = true;
+				
+				// Clean the configuration list, since entries added while deserializing
+				// could have generated default configurations.
+				Configurations.Clear ();
+				
+				base.Deserialize (handler, data);
+	
+				foreach (CombineExecuteDefinition ced in combineExecuteDefinitions)
+					ced.SetCombine (this);
+				
+				foreach (CombineConfiguration conf in Configurations)
+					conf.SetCombine (this);
+			} finally {
+				deserializing = false;
+			}
 		}
 
 		public override void Save (IProgressMonitor monitor)

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -25,9 +25,7 @@
 {
 	public abstract class CombineEntry : ICustomDataItem, IDisposable, IExtendedDataItem
 	{
-		[ItemProperty ("Configurations")]
-		[ItemProperty ("Configuration", ValueType=typeof(IConfiguration), Scope=1)]
-		ConfigurationCollection configurations = new ConfigurationCollection ();
+		ConfigurationCollection configurations;
 		Hashtable extendedProperties;
 
 		Combine parentCombine;
@@ -37,9 +35,17 @@
 		
 		IFileFormat fileFormat;
 		
-		public event CombineEntryRenamedEventHandler NameChanged;
-		public event ConfigurationEventHandler ActiveConfigurationChanged;
+		public CombineEntry ()
+		{
+			configurations = new ConfigurationCollection ();
+			configurations.ConfigurationAdded += new ConfigurationEventHandler (OnConfigurationAddedToCollection);
+			configurations.ConfigurationRemoved += new ConfigurationEventHandler (OnConfigurationRemovedFromCollection);
+		}
 		
+		public virtual void InitializeFromTemplate (XmlElement template)
+		{
+		}
+		
 		IDictionary IExtendedDataItem.ExtendedProperties {
 			get {
 				if (extendedProperties == null)
@@ -126,6 +132,8 @@
 			parentCombine = combine;
 		}
 		
+		[ItemProperty ("Configurations")]
+		[ItemProperty ("Configuration", ValueType=typeof(IConfiguration), Scope=1)]
 		public ConfigurationCollection Configurations {
 			get {
 				return configurations;
@@ -175,10 +183,8 @@
 		
 		public IConfiguration GetConfiguration (string name)
 		{
-			if (configurations != null) {
-				foreach (IConfiguration conf in configurations)
-					if (conf.Name == name) return conf;
-			}
+			foreach (IConfiguration conf in configurations)
+				if (conf.Name == name) return conf;
 			return null;
 		}
 
@@ -222,12 +228,42 @@
 			}
 		}
 		
+		void OnConfigurationAddedToCollection (object ob, ConfigurationEventArgs args)
+		{
+			OnConfigurationAdded (new ConfigurationEventArgs (this, args.Configuration));
+			if (activeConfiguration == null)
+				ActiveConfiguration = args.Configuration;
+		}
+		
+		void OnConfigurationRemovedFromCollection (object ob, ConfigurationEventArgs args)
+		{
+			if (activeConfiguration == args.Configuration) {
+				if (Configurations.Count > 0)
+					ActiveConfiguration = Configurations [0];
+				else
+					ActiveConfiguration = null;
+			}
+			OnConfigurationRemoved (new ConfigurationEventArgs (this, args.Configuration));
+		}
+		
 		protected virtual void OnActiveConfigurationChanged (ConfigurationEventArgs args)
 		{
 			if (ActiveConfigurationChanged != null)
 				ActiveConfigurationChanged (this, args);
 		}
 		
+		protected virtual void OnConfigurationAdded (ConfigurationEventArgs args)
+		{
+			if (ConfigurationAdded != null)
+				ConfigurationAdded (this, args);
+		}
+		
+		protected virtual void OnConfigurationRemoved (ConfigurationEventArgs args)
+		{
+			if (ConfigurationRemoved != null)
+				ConfigurationRemoved (this, args);
+		}
+		
 		public abstract void Clean ();
 		public abstract ICompilerResult Build (IProgressMonitor monitor);
 		public abstract void Execute (IProgressMonitor monitor);
@@ -237,5 +273,10 @@
 		public virtual void GenerateMakefiles (Combine parentCombine)
 		{
 		}
+		
+		public event CombineEntryRenamedEventHandler NameChanged;
+		public event ConfigurationEventHandler ActiveConfigurationChanged;
+		public event ConfigurationEventHandler ConfigurationAdded;
+		public event ConfigurationEventHandler ConfigurationRemoved;
 	}
 }

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -39,6 +39,8 @@
 {
 	public class ConfigurationCollection : CollectionBase
 	{
+		ArrayList tmpClear;
+		
 		public int Add (IConfiguration config)
 		{
 			return List.Add (config);
@@ -73,5 +75,48 @@
 				}
 			}
 		}
+		
+		protected override void OnInsertComplete (int index, object value)
+		{
+			OnConfigurationAdded ((IConfiguration) value);
+		}
+		
+		protected override void OnRemoveComplete (int index, object value)
+		{
+			OnConfigurationRemoved ((IConfiguration) value);
+		}
+		
+		protected override void OnSetComplete (int index, object oldValue, object newValue)
+		{
+			OnConfigurationRemoved ((IConfiguration) oldValue);
+			OnConfigurationAdded ((IConfiguration) newValue);
+		}
+		
+		protected override void OnClear ()
+		{
+			tmpClear = (ArrayList) InnerList.Clone ();
+		}
+		
+		protected override void OnClearComplete ()
+		{
+			foreach (object value in tmpClear)
+				OnConfigurationRemoved ((IConfiguration) value);
+			tmpClear = null;
+		}
+		
+		protected virtual void OnConfigurationAdded (IConfiguration conf)
+		{
+			if (ConfigurationAdded != null)
+				ConfigurationAdded (this, new ConfigurationEventArgs (null, conf));
+		}
+		
+		protected virtual void OnConfigurationRemoved (IConfiguration conf)
+		{
+			if (ConfigurationRemoved != null)
+				ConfigurationRemoved (this, new ConfigurationEventArgs (null, conf));
+		}
+		
+		public event ConfigurationEventHandler ConfigurationAdded;
+		public event ConfigurationEventHandler ConfigurationRemoved;
 	}
 }

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -27,8 +27,7 @@
 
 		public object Clone()
 		{
-			IConfiguration conf = (IConfiguration) System.Activator.CreateInstance (GetType());
-			conf.Name = Name;
+			IConfiguration conf = (IConfiguration) MemberwiseClone ();
 			conf.CopyFrom (this);
 			return conf;
 		}

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -20,7 +20,6 @@
 		/// </summary>
 		string Name {
 			get;
-			set;
 		}
 		
 		void CopyFrom (IConfiguration configuration);

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -56,9 +56,10 @@
 			if (ValueType.BaseType != null) {
 				ClassDataType baseType = (ClassDataType) Context.GetConfigurationDataType (ValueType.BaseType);
 				baseType.AddSubtype (this); 
+				int n=0;
 				foreach (ItemProperty prop in baseType.Properties) {
 					properties.Add (prop.Name, prop);
-					sortedPoperties.Add (prop);
+					sortedPoperties.Insert (n++, prop);
 				}
 			}
 

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineDescriptor.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -20,41 +20,26 @@
 
 namespace MonoDevelop.Internal.Templates
 {
-	public class CombineDescriptor
+	public class CombineDescriptor: ICombineEntryDescriptor
 	{
-		ArrayList projectDescriptors = new ArrayList();
-		ArrayList combineDescriptors = new ArrayList();
+		ArrayList entryDescriptors = new ArrayList();
 		
 		string name;
 		string startupProject    = null;
 		string relativeDirectory = null;
 	
-		#region public properties
 		public string StartupProject {
 			get {
 				return startupProject;
 			}
 		}
 
-		public ArrayList ProjectDescriptors {
-			get {
-				return projectDescriptors;
-			}
-		}
-
-		public ArrayList CombineDescriptors {
-			get {
-				return projectDescriptors;
-			}
-		}
-		#endregion
-
 		protected CombineDescriptor(string name)
 		{
 			this.name = name;
 		}
 		
-		public string CreateCombine(ProjectCreateInformation projectCreateInformation, string defaultLanguage)
+		public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage)
 		{
 			Combine newCombine     = new Combine();
 			string  newCombineName = Runtime.StringParserService.Parse(name, new string[,] { 
@@ -77,15 +62,10 @@
 			}
 
 			// Create sub projects
-			foreach (ProjectDescriptor projectDescriptor in projectDescriptors) {
-				newCombine.AddEntry(projectDescriptor.CreateProject(projectCreateInformation, defaultLanguage), null);
+			foreach (ICombineEntryDescriptor entryDescriptor in entryDescriptors) {
+				newCombine.AddEntry (entryDescriptor.CreateEntry (projectCreateInformation, defaultLanguage), null);
 			}
 			
-			// Create sub combines
-			foreach (CombineDescriptor combineDescriptor in combineDescriptors) {
-				newCombine.AddEntry(combineDescriptor.CreateCombine(projectCreateInformation, defaultLanguage), null);
-			}
-			
 			projectCreateInformation.CombinePath = oldCombinePath;
 			projectCreateInformation.ProjectBasePath = oldProjectPath;
 			
@@ -122,11 +102,14 @@
 				if (node != null) {
 					switch (node.Name) {
 						case "Project":
-							combineDescriptor.projectDescriptors.Add(ProjectDescriptor.CreateProjectDescriptor((XmlElement)node));
+							combineDescriptor.entryDescriptors.Add (ProjectDescriptor.CreateProjectDescriptor((XmlElement)node));
 							break;
 						case "Combine":
-							combineDescriptor.combineDescriptors.Add(CreateCombineDescriptor((XmlElement)node));
+							combineDescriptor.entryDescriptors.Add (CreateCombineDescriptor((XmlElement)node));
 							break;
+						case "CombineEntry":
+							combineDescriptor.entryDescriptors.Add (CombineEntryDescriptor.CreateDescriptor((XmlElement)node));
+							break;
 					}
 				}
 			}

Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -0,0 +1,106 @@
+//
+// CombineEntryDescriptor.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections;
+using System.Collections.Specialized;
+using System.Diagnostics;
+using System.Reflection;
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Core.Services;
+using MonoDevelop.Services;
+using MonoDevelop.Gui;
+
+namespace MonoDevelop.Internal.Templates
+{
+	/// <summary>
+	/// This class is used inside the combine templates for projects.
+	/// </summary>
+	public class CombineEntryDescriptor: ICombineEntryDescriptor
+	{
+		string name;
+		string relativePath;
+		string typeName;
+		XmlElement template;
+		
+		protected CombineEntryDescriptor (XmlElement element)
+		{
+			name = element.GetAttribute ("name");
+			relativePath = element.GetAttribute ("directory");
+			typeName = element.GetAttribute ("type");
+			template = element;
+		}
+		
+		public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage)
+		{
+			StringParserService stringParserService = Runtime.StringParserService;
+			FileUtilityService fileUtilityService = Runtime.FileUtilityService;
+			
+			Type type = Type.GetType (typeName);
+			
+			if (type == null) {
+				Runtime.MessageService.ShowError(String.Format (GettextCatalog.GetString ("Can't create project with type : {0}"), typeName));
+				return String.Empty;
+			}
+			
+			CombineEntry entry = (CombineEntry) Activator.CreateInstance (type);
+			entry.InitializeFromTemplate (template);
+			
+			string newProjectName = stringParserService.Parse (name, new string[,] { 
+				{"ProjectName", projectCreateInformation.ProjectName}
+			});
+			
+			entry.Name = newProjectName;
+			
+			IFileFormat fileFormat = Runtime.ProjectService.FileFormats.GetFileFormatForObject (entry);
+			if (fileFormat == null)
+				throw new InvalidOperationException ("Can't find a file format for the type: " + type);
+
+			string fileName = fileFormat.GetValidFormatName (Path.Combine (projectCreateInformation.ProjectBasePath, newProjectName));
+			
+			using (IProgressMonitor monitor = Runtime.TaskService.GetSaveProgressMonitor ()) {
+				if (File.Exists (fileName)) {
+					if (Runtime.MessageService.AskQuestion(String.Format (GettextCatalog.GetString ("Project file {0} already exists, do you want to overwrite\nthe existing file ?"), fileName),  GettextCatalog.GetString ("File already exists"))) {
+						entry.Save (fileName, monitor);
+					}
+				} else {
+					entry.Save (fileName, monitor);
+				}
+			}
+			
+			return fileName;
+		}
+		
+		public static CombineEntryDescriptor CreateDescriptor (XmlElement element)
+		{
+			return new CombineEntryDescriptor (element);
+		}
+	}
+}

Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -0,0 +1,38 @@
+//
+// ICombineEntryDescriptor.cs
+//
+// Author:
+//   Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+using System;
+
+namespace MonoDevelop.Internal.Templates
+{
+	public interface ICombineEntryDescriptor
+	{
+		string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage);
+	}
+}

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectDescriptor.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -24,7 +24,7 @@
 	/// <summary>
 	/// This class is used inside the combine templates for projects.
 	/// </summary>
-	public class ProjectDescriptor
+	public class ProjectDescriptor: ICombineEntryDescriptor
 	{
 		string name;
 		string relativePath;
@@ -68,7 +68,7 @@
 			this.relativePath = relativePath;
 		}
 		
-		public string CreateProject(ProjectCreateInformation projectCreateInformation, string defaultLanguage)
+		public string CreateEntry (ProjectCreateInformation projectCreateInformation, string defaultLanguage)
 		{
 			StringParserService stringParserService = Runtime.StringParserService;
 			FileUtilityService fileUtilityService = Runtime.FileUtilityService;

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Templates/ProjectTemplates/ProjectTemplate.cs	2005-07-13 15:42:01 UTC (rev 2638)
@@ -186,7 +186,7 @@
 				//	return null;
 				//}
 			} else {
-				lastCombine = combineDescriptor.CreateCombine(projectCreateInformation, this.languagename);
+				lastCombine = combineDescriptor.CreateEntry (projectCreateInformation, this.languagename);
 			}
 			
 			return lastCombine;

Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am	2005-07-13 15:39:12 UTC (rev 2637)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Makefile.am	2005-07-13 15:42:01 UTC (rev 2638)
@@ -466,6 +466,8 @@
 Internal/Templates/ProjectTemplates/ProjectTemplate.cs \
 Internal/Templates/ProjectTemplates/ProjectDescriptor.cs \
 Internal/Templates/ProjectTemplates/CombineDescriptor.cs \
+Internal/Templates/ProjectTemplates/CombineEntryDescriptor.cs \
+Internal/Templates/ProjectTemplates/ICombineEntryDescriptor.cs \
 Internal/Templates/ProjectTemplates/ProjectCreateInformation.cs \
 Internal/CollectionUtilities/DiffUtility.cs \
 Internal/CollectionUtilities/SortUtilityBase.cs \




More information about the Monodevelop-patches-list mailing list