diff options
-rw-r--r-- | Mono.Addins/ChangeLog | 10 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinDatabase.cs | 27 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs | 6 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins.Description/AddinDescription.cs | 2 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins/RuntimeAddin.cs | 27 |
5 files changed, 51 insertions, 21 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index de516f5..8e6676f 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,3 +1,13 @@ +2007-06-26 Lluis Sanchez Gual <lluis@novell.com> + + * Mono.Addins/RuntimeAddin.cs: Assembly loading fix by Brad Taylor. + Fixes endless loop in Initialize. + * Mono.Addins.Description/AddinDescription.cs: Set the hasUserId flag + when loading from xml. + * Mono.Addins.Database/AddinUpdateData.cs, + Mono.Addins.Database/AddinDatabase.cs: Moved add-in update counters + to the AddinUpdateData class, since they need to be updated there. + 2007-05-30 Lluis Sanchez Gual <lluis@novell.com> * Mono.Addins/ExtensionTree.cs: Fix problem with insertbefore, which diff --git a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs index 44485fb..741973b 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs @@ -433,11 +433,6 @@ namespace Mono.Addins.Database Hashtable addinHash = new Hashtable (); - relExtensionPoints = 0; - relExtensions = 0; - relNodeSetTypes = 0; - relExtensionNodes = 0; - if (monitor.VerboseLog) monitor.Log ("Generating add-in extension maps"); @@ -530,19 +525,13 @@ namespace Mono.Addins.Database if (monitor.VerboseLog) { monitor.Log ("Addin relation map generated."); monitor.Log (" Addins Updated: " + descriptionsToSave.Count); - monitor.Log (" Extension points: " + relExtensionPoints); - monitor.Log (" Extensions: " + relExtensions); - monitor.Log (" Extension nodes: " + relExtensionNodes); - monitor.Log (" Node sets: " + relNodeSetTypes); + monitor.Log (" Extension points: " + updateData.RelExtensionPoints); + monitor.Log (" Extensions: " + updateData.RelExtensions); + monitor.Log (" Extension nodes: " + updateData.RelExtensionNodes); + monitor.Log (" Node sets: " + updateData.RelNodeSetTypes); } } - int relExtensionPoints; - int relExtensions; - int relNodeSetTypes; - int relExtensionNodes; - - // Collects extension data in a hash table. The key is the path, the value is a list // of add-ins ids that extend that path @@ -551,7 +540,7 @@ namespace Mono.Addins.Database foreach (ExtensionNodeSet nset in conf.ExtensionNodeSets) { try { updateData.RegisterNodeSet (conf, nset); - relNodeSetTypes++; + updateData.RelNodeSetTypes++; } catch (Exception ex) { throw new InvalidOperationException ("Error reading node set: " + nset.Id, ex); } @@ -560,7 +549,7 @@ namespace Mono.Addins.Database foreach (ExtensionPoint ep in conf.ExtensionPoints) { try { updateData.RegisterExtensionPoint (conf, ep); - relExtensionPoints++; + updateData.RelExtensionPoints++; } catch (Exception ex) { throw new InvalidOperationException ("Error reading extension point: " + ep.Path, ex); } @@ -568,7 +557,7 @@ namespace Mono.Addins.Database foreach (ModuleDescription module in conf.AllModules) { foreach (Extension ext in module.Extensions) { - relExtensions++; + updateData.RelExtensions++; updateData.RegisterExtension (conf, module, ext); AddChildExtensions (conf, module, updateData, ext.Path, ext.ExtensionNodes, false); } @@ -584,7 +573,7 @@ namespace Mono.Addins.Database foreach (ExtensionNodeDescription node in nodes) { if (node.NodeName == "ComplexCondition") continue; - relExtensionNodes++; + updateData.RelExtensionNodes++; string id = node.GetAttribute ("id"); if (id.Length != 0) AddChildExtensions (conf, module, updateData, path + "/" + id, node.ChildNodes, node.NodeName == "Condition"); diff --git a/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs b/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs index 4b76276..ebcfc99 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs @@ -46,6 +46,11 @@ namespace Mono.Addins.Database Hashtable objectTypeExtensions = new Hashtable (); + internal int RelExtensionPoints; + internal int RelExtensions; + internal int RelNodeSetTypes; + internal int RelExtensionNodes; + class RootExtensionPoint { public AddinDescription Description; @@ -61,6 +66,7 @@ namespace Mono.Addins.Database public void RegisterAddinRootExtensionPoint (AddinDescription description, ExtensionPoint ep) { + RelExtensionPoints++; ArrayList list = (ArrayList) pathHash [ep.Path]; if (list == null) { list = new ArrayList (); diff --git a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs index 6059f7f..3750cab 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs @@ -464,6 +464,8 @@ namespace Mono.Addins.Description config.category = elem.GetAttribute ("category"); config.basePath = elem.GetAttribute ("basePath"); config.isroot = elem.GetAttribute ("isroot") == "true" || elem.GetAttribute ("isroot") == "yes"; + if (config.id.Length > 0) + config.hasUserId = true; return config; } diff --git a/Mono.Addins/Mono.Addins/RuntimeAddin.cs b/Mono.Addins/Mono.Addins/RuntimeAddin.cs index 90b1c44..3ebc3f4 100644 --- a/Mono.Addins/Mono.Addins/RuntimeAddin.cs +++ b/Mono.Addins/Mono.Addins/RuntimeAddin.cs @@ -237,8 +237,31 @@ namespace Mono.Addins void LoadModule (ModuleDescription module, string ns, ArrayList plugList, ArrayList asmList) { // Load the assemblies - foreach (string s in module.Assemblies) - asmList.Add (Assembly.LoadFrom (Path.Combine (baseDirectory, s))); + foreach (string s in module.Assemblies) { + Assembly asm = null; + + // don't load the assembly if it's already loaded + string asmPath = Path.Combine (baseDirectory, s); + foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) { + // Sorry, you can't load addins from + // dynamic assemblies as get_Location + // throws a NotSupportedException + if (a is System.Reflection.Emit.AssemblyBuilder) { + continue; + } + + if (a.Location == asmPath) { + asm = a; + break; + } + } + + if (asm == null) { + asm = Assembly.LoadFrom (asmPath); + } + + asmList.Add (asm); + } // Collect dependent ids foreach (Dependency dep in module.Dependencies) { |