[Monodevelop-patches-list] r569 - trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Mon Jan 19 11:46:10 EST 2004
Author: benm
Date: 2004-01-19 11:46:09 -0500 (Mon, 19 Jan 2004)
New Revision: 569
Modified:
trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs
Log:
enable adding resources
Modified: trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs 2004-01-19 06:11:18 UTC (rev 568)
+++ trunk/MonoDevelop/src/Main/Base/Commands/ProjectBrowserCommands/ResourceFolderNodeCommands.cs 2004-01-19 16:46:09 UTC (rev 569)
@@ -25,7 +25,9 @@
using ICSharpCode.SharpDevelop.Gui.Components;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui.Dialogs;
-using ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser;
+using ICSharpCode.SharpDevelop.Gui.Pads.ProjectBrowser;
+
+using Gtk;
namespace ICSharpCode.SharpDevelop.Commands.ProjectBrowser
{
@@ -36,32 +38,41 @@
ProjectBrowserView browser = (ProjectBrowserView)Owner;
FolderNode node = browser.SelectedNode as FolderNode;
- if (node != null) {
- /*using (OpenFileDialog fdiag = new OpenFileDialog()) {
- fdiag.AddExtension = true;
-
- StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
- fdiag.Filter = stringParserService.Parse("${res:SharpDevelop.FileFilter.ResourceFiles}|*.resources;*.resx|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
- fdiag.Multiselect = true;
- fdiag.CheckFileExists = true;
-
- if (fdiag.ShowDialog() == DialogResult.OK) {
- IProject project = ((ProjectBrowserNode)node.Parent).Project;
- IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
- ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-
- foreach (string fileName in fdiag.FileNames) {
- ProjectFile fileInformation = projectService.AddFileToProject(project, fileName, BuildAction.EmbedAsResource);
-
- AbstractBrowserNode newResNode = new FileNode(fileInformation);
- //newResNode.IconImage = resourceService.GetBitmap("Icons.16x16.ResourceFileIcon");
- node.Nodes.Add(newResNode);
- }
- node.Expand();
- projectService.SaveCombine();
- }
- }*/
- Console.WriteLine ("Unported dialog in ResourceFolderNodeCommands.cs");
+ if (node != null) {
+
+ show_dialog:
+
+ Gtk.FileSelection fs = new Gtk.FileSelection ("File to Open");
+ fs.SelectMultiple = true;
+ int response = fs.Run ();
+ string [] files = fs.Selections;
+
+ fs.Destroy ();
+
+ if (response != (int)Gtk.ResponseType.Ok)
+ return;
+
+ foreach (string file in files) {
+ if (! File.Exists (file)) {
+ IMessageService messageService = (IMessageService) ServiceManager.Services.GetService (typeof (IMessageService));
+ messageService.ShowError (String.Format ("Resource file `{0}' does not exist", file));
+ goto show_dialog;
+ }
+ }
+
+ IProject project = ((ProjectBrowserNode) node.Parent).Project;
+ IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
+ ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+
+ foreach (string fileName in files) {
+ ProjectFile fileInformation = projectService.AddFileToProject(project, fileName, BuildAction.EmbedAsResource);
+
+ AbstractBrowserNode newResNode = new FileNode(fileInformation);
+ newResNode.IconImage = resourceService.GetBitmap ("Icons.16x16.ResourceFileIcon");
+ node.Nodes.Add(newResNode);
+ }
+ node.Expand();
+ projectService.SaveCombine();
}
}
}
More information about the Monodevelop-patches-list
mailing list