// 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"))
(...)
您在上下文中注册的条件仅适用于该上下文,因此您可以拥有多个具有不同条件集的上下文。
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.
发布评论
评论(1)
您发现文档中存在空白。现在已更新。
要在本地条件下使用扩展点,您必须创建扩展上下文,设置条件,然后查询扩展点。例如:
您在上下文中注册的条件仅适用于该上下文,因此您可以拥有多个具有不同条件集的上下文。
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:
The conditions you register on a context only apply to that context, so you can have several contexts with different sets of conditions.