插件未随应用程序启动

发布于 2024-12-25 22:36:56 字数 250 浏览 1 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦回梦里 2025-01-01 22:36:56

我希望该插件对其他插件有最少的了解

在这种情况下,您可以执行 Eclipse 所做的操作:在启动器中定义一个扩展点,并让所有需要启动的插件扩展该扩展点。

I'd rather that plugin have minimal knowledge of the other plugins

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.

诺曦 2025-01-01 22:36:56

我会打开“激活...当其中一个类被加载时”,然后确保您在启动时接触了您需要的所有类(无论如何您都必须这样做才能让您的代码运行)。我认为有一些已弃用的方法可以在启动时强制激活插件,但您不需要去那里。一般来说,如果一切设置正确,只需调用插件中的类就会导致它被加载并启动,您不需要做任何特殊的事情。

您的应用程序可能具有由 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文