diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-05-25 19:02:55 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-05-25 19:02:55 +0400 |
commit | 5c61ec56cacc6bd006931b1c2d0fa04a1de19f1b (patch) | |
tree | 51fd878f2ec13640d9c38af6390f3a89346a4517 | |
parent | e888cb2d660bba9d05774fba2f0f54de6df1d5cf (diff) |
* Mono.Addins/AddinManager.cs:
* Mono.Addins/ExtensionContext.cs: Added methods for subscribing
type-bound extension points.
svn path=/trunk/mono-addins/; revision=157857
-rw-r--r-- | Mono.Addins/ChangeLog | 6 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins/AddinManager.cs | 14 | ||||
-rw-r--r-- | Mono.Addins/Mono.Addins/ExtensionContext.cs | 16 |
3 files changed, 35 insertions, 1 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index ed792d8..0f4e665 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,5 +1,11 @@ 2010-05-25 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins/AddinManager.cs: + * Mono.Addins/ExtensionContext.cs: Added methods for + subscribing type-bound extension points. + +2010-05-25 Lluis Sanchez Gual <lluis@novell.com> + * Mono.Addins.csproj: Add Debug and Release configurations. * Mono.Addins.Database/AddinScanner.cs: Fixed node type diff --git a/Mono.Addins/Mono.Addins/AddinManager.cs b/Mono.Addins/Mono.Addins/AddinManager.cs index 2377bc8..dfed58c 100644 --- a/Mono.Addins/Mono.Addins/AddinManager.cs +++ b/Mono.Addins/Mono.Addins/AddinManager.cs @@ -258,7 +258,7 @@ namespace Mono.Addins add { AddinEngine.CheckInitialized(); AddinEngine.ExtensionChanged += value; } remove { AddinEngine.CheckInitialized(); AddinEngine.ExtensionChanged -= value; } } - + public static void AddExtensionNodeHandler (string path, ExtensionNodeEventHandler handler) { AddinEngine.CheckInitialized (); @@ -271,6 +271,18 @@ namespace Mono.Addins AddinEngine.RemoveExtensionNodeHandler (path, handler); } + public static void AddExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) + { + AddinEngine.CheckInitialized (); + AddinEngine.AddExtensionNodeHandler (instanceType, handler); + } + + public static void RemoveExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) + { + AddinEngine.CheckInitialized (); + AddinEngine.RemoveExtensionNodeHandler (instanceType, handler); + } + public static event AddinErrorEventHandler AddinLoadError { add { AddinEngine.AddinLoadError += value; } remove { AddinEngine.AddinLoadError -= value; } diff --git a/Mono.Addins/Mono.Addins/ExtensionContext.cs b/Mono.Addins/Mono.Addins/ExtensionContext.cs index c0edbb2..ed6399a 100644 --- a/Mono.Addins/Mono.Addins/ExtensionContext.cs +++ b/Mono.Addins/Mono.Addins/ExtensionContext.cs @@ -374,6 +374,22 @@ namespace Mono.Addins node.ExtensionNodeChanged -= handler; } + public void AddExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) + { + string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); + if (path == null) + throw new InvalidOperationException ("Type '" + instanceType + "' not bound to an extension point."); + AddExtensionNodeHandler (path, handler); + } + + public void RemoveExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) + { + string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); + if (path == null) + throw new InvalidOperationException ("Type '" + instanceType + "' not bound to an extension point."); + RemoveExtensionNodeHandler (path, handler); + } + void OnConditionChanged (object s, EventArgs a) { ConditionType cond = (ConditionType) s; |