Search code examples
javaeclipse-pluginrcpeclipse-indigo

Eclipse RCP - implementing extension point. Where to evaluate?


  • I'm implementing an extension with an own extension-point in Eclipse 3.7 Indigo.
  • I found a way to get all plugins, which will contribute functionality to my extension-point. This is described here

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


Solution

  • 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.