Author: mhutch
Date: 2006-11-26 15:43:33 -0500 (Sun, 26 Nov 2006)
New Revision: 68488

Modified:
   trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Editor/EditorHost.cs
   trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/EditorProcess.cs
   
trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/MonoDevelopProxy.cs
   trunk/monodevelop/Extras/AspNetEdit/ChangeLog
Log:
2006-11-26  Michael Hutchinson <[EMAIL PROTECTED]>

        * AspNetEdit.Integration/EditorProcess.cs:
        * AspNetEdit.Editor/EditorHost.cs: Exceptions coming through the 
        EditorHost constructor aren't being passed up to EditorProcess LoadGui 
        method. Not sure why, and no time to follow it up right now, but 
        implemented a workaround.
        
        * AspNetEdit.Editor/EditorHost.cs: When disposing, don't
        assume that designerView was created successfully.
        
        * AspNetEdit.Integration/MonoDevelopProxy.cs: Added a way to
        access the MessageService from the out-of-process designer.
        



Modified: trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Editor/EditorHost.cs
===================================================================
--- trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Editor/EditorHost.cs 
2006-11-26 20:41:30 UTC (rev 68487)
+++ trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Editor/EditorHost.cs 
2006-11-26 20:43:33 UTC (rev 68488)
@@ -53,14 +53,7 @@
                MonoDevelopProxy proxy;
                
                public EditorHost (MonoDevelopProxy proxy)
-                       : this (proxy, null, null)
                {
-               }
-               
-               public EditorHost (MonoDevelopProxy proxy, string document, 
string fileName)
-               {
-                       
MonoDevelop.Core.Gui.Services.DispatchService.AssertGuiThread ();
-                       
                        this.proxy = proxy;
                        
                        //set up the services
@@ -75,16 +68,29 @@
                        services.AddService (typeof 
(ITypeDescriptorFilterService), new TypeDescriptorFilterService ());
                        //services.AddService (typeof (IToolboxService), 
toolboxService);
                        
-                       System.Diagnostics.Trace.WriteLine ("Creating 
AspNetEdit editor");
+                       System.Diagnostics.Trace.WriteLine ("Creating 
DesignerHost");
                        host = new DesignerHost (services);
+                       System.Diagnostics.Trace.WriteLine ("Created 
DesignerHost");
+               }
+               
+               public void Initialise ()
+               {
+                               Initialise (null, null);
+               }
+               
+               public void Initialise (string document, string fileName)
+               {
+                       
MonoDevelop.Core.Gui.Services.DispatchService.AssertGuiThread ();
                        
+                       System.Diagnostics.Trace.WriteLine ("Loading document 
into DesignerHost");
                        if (document != null)
                                host.Load (document, fileName);
                        else
                                host.NewFile ();
+                       System.Diagnostics.Trace.WriteLine ("Loaded document 
into DesignerHost");
                        
                        host.Activate ();
-                       System.Diagnostics.Trace.WriteLine ("AspNetEdit host 
activated; getting designer view");
+                       System.Diagnostics.Trace.WriteLine ("DesignerHost 
activated; getting designer view");
                        
                        IRootDesigner rootDesigner = (IRootDesigner) 
host.GetDesigner (host.RootComponent);
                        designerView = (RootDesignerView) rootDesigner.GetView 
(ViewTechnology.Passthrough);
@@ -92,7 +98,11 @@
                }
                
                public Gtk.Widget DesignerView {
-                       get { return designerView; }
+                       get {
+                               if (designerView == null)
+                                       throw new InvalidOperationException 
("DesignerView has not been initialised. Have you sucessfully called 
EditorHost.Initialise?");
+                               return designerView;
+                       }
                }
                
                public ServiceContainer Services {
@@ -130,7 +140,7 @@
                        
MonoDevelop.Core.Gui.Services.DispatchService.AssertGuiThread ();
                        string doc = "";
                        
-                       System.Console.WriteLine("persisting document");
+                       System.Diagnostics.Trace.WriteLine ("persisting 
document");
                        doc = host.PersistDocument ();
                                
                        return doc;
@@ -141,13 +151,18 @@
                bool disposed = false;
                public virtual void Dispose ()
                {
-                       System.Console.WriteLine("disposing editor host");
+                       System.Diagnostics.Trace.WriteLine ("disposing editor 
host");
+                       
                        if (disposed)
                                return;
-                       
                        disposed = true;
-                       designerView.Dispose ();
                        
+                       if (designerView == null) {
+                               System.Diagnostics.Trace.WriteLine 
("DesignerView is already null when disposing; was it created correctly?");
+                       } else {
+                               designerView.Dispose ();
+                       }
+                       
                        GC.SuppressFinalize (this);
                }
                

Modified: 
trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/EditorProcess.cs
===================================================================
--- trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/EditorProcess.cs 
2006-11-26 20:41:30 UTC (rev 68487)
+++ trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/EditorProcess.cs 
2006-11-26 20:43:33 UTC (rev 68488)
@@ -76,7 +76,8 @@
                void LoadGui (MonoDevelopProxy proxy, string document, string 
fileName)
                {
                        System.Diagnostics.Trace.WriteLine ("Creating 
AspNetEdit EditorHost");
-                       host = new EditorHost (proxy, document, fileName);
+                       host = new EditorHost (proxy);
+                       host.Initialise (document, fileName);
                        System.Diagnostics.Trace.WriteLine ("Created AspNetEdit 
EditorHost");
                        
                        System.Diagnostics.Trace.WriteLine ("Building 
AspNetEdit GUI");
@@ -90,7 +91,7 @@
                        Toolbar tb = BuildToolbar ();
                        outerBox.PackStart (tb, false, false, 0);
                        
-                       outerBox.ShowAll ();    
+                       outerBox.ShowAll ();
                        base.DesignerWidget = outerBox;
                        
                        //grid picks up some services from the designer host
@@ -157,7 +158,7 @@
                bool disposed = false;
                public override void Dispose ()
                {
-                       System.Diagnostics.Trace.WriteLine("Disposing 
AspNetEdit editor process");
+                       System.Diagnostics.Trace.WriteLine ("Disposing 
AspNetEdit editor process");
                        
                        if (disposed)
                                return;

Modified: 
trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/MonoDevelopProxy.cs
===================================================================
--- 
trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/MonoDevelopProxy.cs  
    2006-11-26 20:41:30 UTC (rev 68487)
+++ 
trunk/monodevelop/Extras/AspNetEdit/AspNetEdit.Integration/MonoDevelopProxy.cs  
    2006-11-26 20:43:33 UTC (rev 68488)
@@ -50,6 +50,13 @@
                        this.codeBehindClass = codeBehindClass;
                }
                
+               #region services (must all be GuiSyncObjects, i.e. MarshalByRef)
+               public MonoDevelop.Core.Gui.MessageService MessageService {
+                       get {
+                               return IdeApp.Services.MessageService;
+                       }
+               }               
+               #endregion
                
                //TODO: make this work with inline code
                #region event binding

Modified: trunk/monodevelop/Extras/AspNetEdit/ChangeLog
===================================================================
--- trunk/monodevelop/Extras/AspNetEdit/ChangeLog       2006-11-26 20:41:30 UTC 
(rev 68487)
+++ trunk/monodevelop/Extras/AspNetEdit/ChangeLog       2006-11-26 20:43:33 UTC 
(rev 68488)
@@ -1,3 +1,18 @@
+2006-11-26  Michael Hutchinson <[EMAIL PROTECTED]>
+
+       * AspNetEdit.Integration/EditorProcess.cs:
+       * AspNetEdit.Editor/EditorHost.cs: Exceptions coming through the 
+       EditorHost constructor aren't being passed up to EditorProcess LoadGui 
+       method. Not sure why, and no time to follow it up right now, but 
+       implemented a workaround.
+       
+       * AspNetEdit.Editor/EditorHost.cs: When disposing, don't
+       assume that designerView was created successfully.
+       
+       * AspNetEdit.Integration/MonoDevelopProxy.cs: Added a way to
+       access the MessageService from the out-of-process designer.
+       
+
 2006-11-14  Michael Hutchinson <[EMAIL PROTECTED]>
 
        * data/WebControlsToolbox.xml: Default toolbox file of ASP.NET 2.0 

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

Reply via email to