向 eclipse RCP 应用程序添加自动启动插件
我有一个 Eclipse RCP 应用程序,我试图安装一个我创建的插件,但没有成功,该插件应该单独部署到上述应用程序。
为此,我以 ./App -console
启动应用程序,当它停止加载时,我输入:
install file://URLTOjAR/plugin.jar
它返回我一个插件 ID(比如说 288
) ,所以我随后输入:
start 288
此后,插件工作正常,但是当我重新启动应用程序时,通过使用 ss 我只能看到该插件只是“已解决”,但我希望启动它。
有没有办法自动执行此操作?
I have an Eclipse RCP application, and I am trying with no luck to install a plugin I have created that should be deployed separately to the aforementioned application.
To do so, I start the application as ./App -console
, and when it has stopped loading, I type:
install file://URLTOjAR/plugin.jar
It returns me a plugin ID (lets say 288
), so I type afterwards:
start 288
After this, the plugin is working fine, but when I restart the application, by using ss I only can see that the plugin is only "Resolved", but I'd like it to be started.
Is there a way to automate this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
由于您使用的是 Eclipse RCP 应用程序,因此您很可能使用 SimpleConfigurator 来确定当前安装的捆绑包列表。打开文件 App/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
在该文件中,有已安装的包的列表、它们的版本以及它们是否应该自动启动。您将看到这样的一行:
该行的不同部分如下:
因此,只需在您的bundles.info 中添加这样一行,您就可以开始了。
Since you are using an Eclipse RCP app, you are most likely using a SimpleConfigurator to determine your list of currently installed bundles. Open the file App/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
In that file there is a list of installed bundles, their versions and whether or not they should auto-started. You will see a line like this:
The different parts of the line are this:
So, just add a line like this in your bundles.info and you should be good to go.
安装并启动的捆绑包应在下次启动时启动。
当框架尝试启动捆绑包并且它保持在“已解决”状态时,激活器可能会引发异常。检查日志。也许捆绑包不能很好地处理启动时尚不可用的服务和资源。
The installed and started bundle should be started on the next start.
Maybe the activator throws an exception when the framework tries to start the bundle and it remains in RESOLVED state. Check the logs. Maybe the bundle doesn't handle well the services, resources which are not (yet) available when it's starting.
这是解决这个问题的另一种方法。比使用简单的配置器有点混乱(请参阅我的其他答案),但它应该更广泛适用。
在文件configuration/config.ini中,应该有一个属性
osgi.bundles
。此属性采用逗号分隔的包列表,以在 osgi 实例中使用。该属性如下所示:@1 是捆绑包的启动级别,
:start
表示捆绑包应该自动启动。And here's another way to do solve this. A bit messier than using the simple configurator (see my other answer), but it should be more widely applicable.
In the file configuration/config.ini, there should be a property
osgi.bundles
. This property takes a comma separated list of bundles to use in the osgi instance. The property looks like this:The @1 is the start level of the bundle and
:start
means that the bundle should be autostarted.我不确定我是否正确回答了你的问题。但我会尝试一下:
为什么你要尝试安装与应用程序无关的捆绑包/插件。如果你的插件/捆绑包与正在运行的应用程序环境无关,那么只需使用 eclispe 环境来启动捆绑包需要其他插件。
我认为这里发生的事情是你的包被延迟加载。如果应用程序插件不使用该捆绑包,那就有意义了。
如果您确实想让捆绑包与您的应用程序一起启动,您可以做的是,
找到配置文件列出了 RCP 应用程序中捆绑包的所有启动信息。
*这可以是config.ini文件
*或bundles.info 文件(如果应用程序使用simpleconfigurator)
将您的捆绑包信息插入配置文件之一。 (如果您想立即启动,则需要设置一个参数 - 'true')
HTH,
——普拉迪普
I'm not sure weather i got your question right. But i will give a try:
why are you trying to install bundle/plugin that is not related to the application.If your plugin/bundle has nothing to with the running application environment then just use eclispe environment to launch the bundle with required other plugins.
I think what is happening here is you that bundle get lazy loaded. If the Application plugins does not use the bundle it make sense.
If you really want to make the bundle start with the your application, what you can do is to,
find the configuration file that list all the start info of bundle in your RCP app.
*This can be config.ini file
*or the bundles.info file if the application is using simpleconfigurator
insert your bundle information in one of the config files. (theres a parameter to set if you want immediate start - 'true')
HTH,
--Pradeep
创建另一个插件,该插件:
BundleListener
)。Create another plugin which:
BundleListener
).