开发者

Using Mono.Addins local conditions

开发者 https://www.devze.com 2023-01-11 07:42 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号