Skip
Skip

Reputation: 6531

Eclipse RCP - implementing extension point. Where to evaluate?

Question:
Where should the evaluation of the contributed information be done? In which class?

Upvotes: 0

Views: 947

Answers (1)

Paul Webster
Paul Webster

Reputation: 10654

It should be triggered when something you contribute needs that information. A common pattern for example is you contribute a view and use an extension point to allow others to contribute to your view. Put your extension point code in MyViewRegistry and have it read the extension point on instantiation. Then create:

private static MyViewRegistry registry = null;
public MyViewRegistry getRegistry() {
    if (registry == null) {
        registry = new MyViewRegistry();
        registry.read();
    }
    return registry;
}

Then when you view actually needs the extension information, it will trigger the load.

Upvotes: 1

Related Questions