Author: lluis
Date: 2006-12-11 07:37:25 -0500 (Mon, 11 Dec 2006)
New Revision: 69314

Added:
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs
Modified:
   trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
   trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
   
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
   trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
Log:
* MonoDevelop.Ide.mdp, Makefile.am,
  MonoDevelop.Ide.Gui/AddEntryEventHandler.cs: Added file
  AddEntryEventHandler.cs.
* MonoDevelop.Ide.Gui/ProjectOperations.cs: Fire the
  AddingEntryToCombine event just before adding the entry.

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2006-12-11 
12:14:02 UTC (rev 69313)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/ChangeLog        2006-12-11 
12:37:25 UTC (rev 69314)
@@ -1,3 +1,11 @@
+2006-12-11  Lluis Sanchez Gual <[EMAIL PROTECTED]> 
+
+       * MonoDevelop.Ide.mdp, Makefile.am,
+         MonoDevelop.Ide.Gui/AddEntryEventHandler.cs: Added file
+         AddEntryEventHandler.cs.
+       * MonoDevelop.Ide.Gui/ProjectOperations.cs: Fire the
+         AddingEntryToCombine event just before adding the entry.
+
 2006-12-05  Ankit Jain  <[EMAIL PROTECTED]>
 
        * MonoDevelop.Ide.Gui/ProjectOperations.cs (backgroundLoadCombine): Try

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am      2006-12-11 
12:14:02 UTC (rev 69313)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/Makefile.am      2006-12-11 
12:37:25 UTC (rev 69314)
@@ -83,6 +83,7 @@
 MonoDevelop.Ide.Gui/AbstractPadContent.cs \
 MonoDevelop.Ide.Gui/AbstractSecondaryViewContent.cs \
 MonoDevelop.Ide.Gui/AbstractViewContent.cs \
+MonoDevelop.Ide.Gui/AddEntryEventHandler.cs \
 MonoDevelop.Ide.Gui/ExitEventHandler.cs \
 MonoDevelop.Ide.Gui/FileViewer.cs \
 MonoDevelop.Ide.Gui/IBaseViewContent.cs \

Added: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs
      2006-12-11 12:14:02 UTC (rev 69313)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/AddEntryEventHandler.cs
      2006-12-11 12:37:25 UTC (rev 69314)
@@ -0,0 +1,28 @@
+
+using System;
+
+namespace MonoDevelop.Ide.Gui
+{
+       public delegate void AddEntryEventHandler (object s, AddEntryEventArgs 
args);
+       
+       public class AddEntryEventArgs
+       {
+               string fileName;
+               bool cancel;
+               
+               public AddEntryEventArgs (string fileName)
+               {
+                       this.fileName = fileName;
+               }
+               
+               public string FileName {
+                       get { return fileName; }
+                       set { fileName = value; }
+               }
+               
+               public bool Cancel {
+                       get { return cancel; }
+                       set { cancel = value; }
+               }
+       }
+}

Modified: 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
===================================================================
--- 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
 2006-12-11 12:14:02 UTC (rev 69313)
+++ 
trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProjectOperations.cs
 2006-12-11 12:37:25 UTC (rev 69314)
@@ -482,15 +482,13 @@
                                npdlg.SelectTemplate 
("MonoDevelop.BlankSolution");
 
                        if (npdlg.Run () == (int) Gtk.ResponseType.Ok) {
-                               IProgressMonitor monitor = 
IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor ();
                                try {
-                                       res = parentCombine.AddEntry 
(npdlg.NewCombineEntryLocation, monitor);
+                                       res = AddCombineEntry (parentCombine, 
npdlg.NewCombineEntryLocation);
                                }
                                catch {
                                        Services.MessageService.ShowError 
(string.Format (GettextCatalog.GetString ("The file '{0}' could not be 
loaded."), npdlg.NewCombineEntryLocation));
                                        res = null;
                                }
-                               monitor.Dispose ();
                        }
 
                        if (res != null)
@@ -508,9 +506,7 @@
                                fdiag.SelectMultiple = false;
                                if (fdiag.Run () == (int) Gtk.ResponseType.Ok) {
                                        try {
-                                               using (IProgressMonitor monitor 
= IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor ()) {
-                                                       res = 
parentCombine.AddEntry (fdiag.Filename, monitor);
-                                               }
+                                               res = AddCombineEntry 
(parentCombine, fdiag.Filename);
                                        }
                                        catch {
                                                
Services.MessageService.ShowError (string.Format (GettextCatalog.GetString 
("The file '{0}' could not be loaded."), fdiag.Filename));
@@ -525,6 +521,18 @@
                        return res;
                }
                
+               public CombineEntry AddCombineEntry (Combine combine, string 
entryFileName)
+               {
+                       AddEntryEventArgs args = new AddEntryEventArgs 
(entryFileName);
+                       if (AddingEntryToCombine != null)
+                               AddingEntryToCombine (this, args);
+                       if (args.Cancel)
+                               return null;
+                       using (IProgressMonitor monitor = 
IdeApp.Workbench.ProgressMonitors.GetLoadProgressMonitor ()) {
+                               return combine.AddEntry (args.FileName, 
monitor);
+                       }
+               }
+
                public void CreateProjectFile (Project parentProject, string 
basePath)
                {
                        CreateProjectFile (parentProject, basePath, null);
@@ -950,7 +958,6 @@
                        }
                }
                
-
                public void TransferFiles (IProgressMonitor monitor, Project 
sourceProject, string sourcePath, Project targetProject, string targetPath, 
bool removeFromSource, bool copyOnlyProjectFiles)
                {
                        if (targetProject == null)
@@ -1222,6 +1229,9 @@
                
                public event ProjectReferenceEventHandler 
ReferenceAddedToProject;
                public event ProjectReferenceEventHandler 
ReferenceRemovedFromProject;
+               
+               // Fired just before an entry is added to a combine
+               public event AddEntryEventHandler AddingEntryToCombine;
 
                
                // All methods inside this class are gui thread safe

Modified: trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp      
2006-12-11 12:14:02 UTC (rev 69313)
+++ trunk/monodevelop/Core/src/MonoDevelop.Ide/MonoDevelop.Ide.mdp      
2006-12-11 12:37:25 UTC (rev 69314)
@@ -264,6 +264,7 @@
     <File name="./icons/mono-powered.png" subtype="Code" 
buildaction="EmbedAsResource" />
     <File name="./icons/parsing.png" subtype="Code" 
buildaction="EmbedAsResource" />
     <File name="./MonoDevelop.Ide.Gui/LayoutComboBox.cs" subtype="Code" 
buildaction="Compile" />
+    <File name="./MonoDevelop.Ide.Gui/AddEntryEventHandler.cs" subtype="Code" 
buildaction="Compile" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="MonoDevelop.Core" 
/>

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to