tags:

views:

19

answers:

1

As described here how do you " register an instance of the ConditionType" on the AddinManager?

+1  A: 

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.

Lluis Sanchez