插件未随应用程序启动
我有一个 RCP 应用程序,其中定义了几个用于数据和功能分离的插件。
我需要在应用程序启动时激活所有插件(其中一些插件需要注册网络事件)。我未选中“加载其中一个类时激活此插件”框,从选中和取消选中此框时查看 xml 来看,这实际上是一个延迟加载指示器。
如果我将插件添加到 .product 中的配置页面,我会得到每个激活器的 ClassNotFoundExceptions。
当 RCP 应用程序启动时,让插件自动启动的最佳方法是什么?
I have an RCP application that has several plugins defined in it for data and functional seperation.
I need all of the plugins to activate when the application starts (a couple of them need to register for network events). I have the "Activate this plug-in when one of it's classes is loaded" box unchecked, from looking at the xml when this box is checked and unchecked it appears that this is actually a lazy loading indicator.
If I add the plugins to the configuration page in the .product I get ClassNotFoundExceptions for each of the activators.
What is the best way to get a plugin to start automatically when an RCP application starts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,您可以执行 Eclipse 所做的操作:在启动器中定义一个扩展点,并让所有需要启动的插件扩展该扩展点。
In that case you can do what Eclipse does: define an extension point in launcher and let all plugins that need to be started extend that extension point.
我会打开“激活...当其中一个类被加载时”,然后确保您在启动时接触了您需要的所有类(无论如何您都必须这样做才能让您的代码运行)。我认为有一些已弃用的方法可以在启动时强制激活插件,但您不需要去那里。一般来说,如果一切设置正确,只需调用插件中的类就会导致它被加载并启动,您不需要做任何特殊的事情。
您的应用程序可能具有由 Eclipse 启动调用的类之一(例如 WindowWorkbenchAdvisor 或类似的东西(启动中有很多挂钩),只需选择有意义的一个并调用您的代码即可。
I would turn on the "Activate... when one of it's classes are loaded" and then just make sure you touch all of the classes you need at startup time (which you will have to do anyways to get your code going). I think there are some deprecated methods of forcing plugin activation at startup, but you should not need to go there. In general, just calling a class in the plugin will cause it to be loaded and started if everything is set up right, you should not need to do anything special.
Your app presumably has one of the classes called by the Eclipse boot (like
WindowWorkbenchAdvisor
or something like that (there are many hooks in the boot), just pick the one that makes sense and call your code.