Using Mono.Addins local conditions
As described here how do you " register an instance of the Conditio开发者_开发技巧nType" on the AddinManager?
You found a gap in the documentation. It is now updated.
To use extension points with local conditions, you have to create an Extension Context, setup the conditions, and then query the extension point. For example:
// Create an extension context to be used to query the extension point using
// a specific set of conditions.
ExtensionContext ctx = AddinManager.CreateExtensionContext ();
// Create and register the extension point condition
OpenFileLocalCondition condition = new OpenFileLocalCondition (someFileName);
ctx.RegisterCondition (condition);
// Query the extension point
foreach (ExtensionNode node in ctx.GetExtensionNodes ("/TextEditor/ContextMenu"))
(...)
The conditions you register on a context only apply to that context, so you can have several contexts with different sets of conditions.
精彩评论