此文对帮助文档中IStartup的内容做注解和补充,详情请见Eclipse帮助文档.
*执行顺序
---start()-->earlyStartup()
Plugin.startup(),Plugin.start(BundleContext context),IStartup.earlyStartup().
从3.0开始start()取代startup(),startup()被废弃
---Workbench.runUI(){display.readAndDispatch()->开始激活bundle,startPlugins()->加载org.eclipse.ui.IStartup}
*如何使用这个特性?
---帮助文档如是描述,"Plugins that provide an extension to this extension point are listed in the workbench preferences and the user may disable any plugin from early startup"
举例,
在earlyStartup()中对插件的操作
*注意class - a fully qualified name of the class that implements org.eclipse.ui.IStartup. If not specified, the plug-in class is used. Do not specify the plug-in class as an explicit value, or it will be instantiated twice (once by regular plug-in activation, and once by this mechanism).
若不看源码或尝试执行,这里的注释可能会导致歧义.以下根据实践说明,
---"If not specified, the plug-in class is used"?
其实就是扩展点不起作用,即使Plugin实现IStartup,Plugin也不会被执行.
---"Do not specify the plug-in class as an explicit value"?
若Plugin被定义在IStartup扩展点中,这将意味着产生两个Plugin类实例,所以不推荐.
*使用IStartup的好处
---"the method earlyStartup() will be called from a separate thread"
这个扩展点的意义在于在激活bundle之外,以一个高的优先级完成一些预操作.