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

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Mon Jan 19 13:00:29 EST 2004


Author: benm
Date: 2004-01-19 13:00:29 -0500 (Mon, 19 Jan 2004)
New Revision: 570

Modified:
   trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
Log:
some reference adding stuff

Modified: trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs	2004-01-19 16:46:09 UTC (rev 569)
+++ trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ReferenceFolderNodeCommands.cs	2004-01-19 18:00:29 UTC (rev 570)
@@ -41,7 +41,8 @@
 				
 				SelectReferenceDialog selDialog = new SelectReferenceDialog(project);
 				if (selDialog.Run() == (int)Gtk.ResponseType.Ok) {
-						
+					
+					project.ProjectReferences.Clear ();
 					foreach (ProjectReference refInfo in selDialog.ReferenceInformations) {
 						project.ProjectReferences.Add(refInfo);
 						parserService.AddReferenceToCompletionLookup(project, refInfo);

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs	2004-01-19 16:46:09 UTC (rev 569)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/ProjectReferencePanel.cs	2004-01-19 18:00:29 UTC (rev 570)
@@ -11,10 +11,74 @@
 using ICSharpCode.SharpDevelop.Internal.Project;
 
 using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
+using ICSharpCode.SharpDevelop.Services;
 
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs
-{
+using Gtk;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs {
+	
+	public class ProjectReferencePanel : VBox, IReferencePanel {
+		SelectReferenceDialog selectDialog;
+		ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+
+		TreeStore store;
+		TreeView  treeView;
+		
+		public ProjectReferencePanel (SelectReferenceDialog selectDialog) : base (false, 6)
+		{
+			this.selectDialog = selectDialog;
+			
+			store = new TreeStore (typeof (string), typeof (string), typeof(IProject));
+			treeView = new TreeView (store);
+			treeView.AppendColumn (resourceService.GetString ("Dialog.SelectReferenceDialog.ProjectReferencePanel.NameHeader"), new CellRendererText (), "text", 0);
+			treeView.AppendColumn (resourceService.GetString ("Dialog.SelectReferenceDialog.ProjectReferencePanel.DirectoryHeader"), new CellRendererText (), "text", 1);
+			
+			
+			PopulateListView ();
+			ScrolledWindow sc = new ScrolledWindow ();
+			sc.AddWithViewport (treeView);
+			PackStart (sc, true, true, 0);
+			
+			Button b = new Button (Stock.Add);
+			b.Clicked += new EventHandler (AddReference);
+			
+			PackEnd (b, false, false, 0);
+		}
+		
+		void AddReference (TreeModel model, TreePath path, TreeIter iter)
+		{
+			IProject project = (IProject) model.GetValue (iter, 2);
+			LanguageBindingService languageBindingService = (LanguageBindingService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(LanguageBindingService));
+			ILanguageBinding binding = languageBindingService.GetBindingPerLanguageName(project.ProjectType);
+			
+			selectDialog.AddReference(ReferenceType.Project,
+						  project.Name,
+						  binding.GetCompiledOutputName(project));
+		}
+		
+		public void AddReference(object sender, EventArgs e)
+		{
+			treeView.Selection.SelectedForeach (new TreeSelectionForeachFunc (AddReference));
+		}	
+		
+		void PopulateListView ()
+		{
+			IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
+			
+			Combine openCombine = projectService.CurrentOpenCombine;
+			
+			if (openCombine == null) {
+				return;
+			}
+			
+			ArrayList projects = Combine.GetAllProjects(openCombine);
+			
+			foreach (ProjectCombineEntry projectEntry in projects) {
+				store.AppendValues (projectEntry.Project.Name, projectEntry.Project.BaseDirectory, projectEntry.Project);
+			}
+		}
+	}
+	
 /*	public class ProjectReferencePanel : ListView//, IReferencePanel
 	{
 		SelectReferenceDialog selectDialog;
@@ -54,23 +118,6 @@
 			}
 		}
 		
-		void PopulateListView()
-		{
-			IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
-			
-			Combine openCombine = projectService.CurrentOpenCombine;
-			
-			if (openCombine == null) {
-				return;
-			}
-			
-			ArrayList projects = Combine.GetAllProjects(openCombine);
-			
-			foreach (ProjectCombineEntry projectEntry in projects) {
-				ListViewItem newItem = new ListViewItem(new string[] { projectEntry.Project.Name, projectEntry.Project.BaseDirectory });
-				newItem.Tag = projectEntry.Project;
-				Items.Add(newItem);
-			}
-		}
+
 	}*/
 }

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs	2004-01-19 16:46:09 UTC (rev 569)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs	2004-01-19 18:00:29 UTC (rev 570)
@@ -20,7 +20,6 @@
 {
 	public interface IReferencePanel
 	{
-		void AddReference(object sender, GtkSharp.ToggledArgs e);
 	}
 	
 	/// <summary>
@@ -116,13 +115,16 @@
 			//InitializeComponent();
 		
 			mainBook.RemovePage (mainBook.CurrentPage);
-			mainBook.AppendPage (new GacReferencePanel (this), new Gtk.Label (resourceService.GetString("Dialog.SelectReferenceDialog.GacTabPage")));
+			mainBook.AppendPage (new GacReferencePanel (this), new Gtk.Label (resourceService.GetString("Dialog.SelectReferenceDialog.GacTabPage")));
+			mainBook.AppendPage (new ProjectReferencePanel (this), new Gtk.Label (resourceService.GetString("Dialog.SelectReferenceDialog.ProjectTabPage")));
+			mainBook.CurrentPage = 0;
 			//gacTabPage.Controls.Add(new GacReferencePanel(this));
 			//projectTabPage.Controls.Add(new ProjectReferencePanel(this));
 			//browserTabPage.Controls.Add(new AssemblyReferencePanel(this));
 			
 			//comTabPage.Controls.Add(new COMReferencePanel(this));
-			AddReferenceDialog.ShowAll ();
+			AddReferenceDialog.ShowAll ();
+			mainBook.CurrentPage = 0;
 		}
 		
 		public void RemoveReference (ReferenceType referenceType, string referenceName, string referenceLocation)




More information about the Monodevelop-patches-list mailing list