简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM