向 eclipse RCP 应用程序添加自动启动插件

发布于 2024-12-14 06:25:00 字数 364 浏览 2 评论 0原文

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

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

发布评论

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

评论(5

属性 2024-12-21 06:25:00

由于您使用的是 Eclipse RCP 应用程序,因此您很可能使用 SimpleConfigurator 来确定当前安装的捆绑包列表。打开文件 App/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info

在该文件中,有已安装的包的列表、它们的版本以及它们是否应该自动启动。您将看到这样的一行:

ch.qos.logback.classic,0.9.27.v20110224-1110,plugins/ch.qos.logback.classic_0.9.27.v20110224-1110.jar,4,false

该行的不同部分如下:

  1. 捆绑包标识符
  2. 捆绑包版本
  3. jar 文件名,相对于安装位置
  4. 启动级别(通常只需将其设置为 4)
  5. 是否自动启动您的捆绑包,将其更改为 true。

因此,只需在您的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:

ch.qos.logback.classic,0.9.27.v20110224-1110,plugins/ch.qos.logback.classic_0.9.27.v20110224-1110.jar,4,false

The different parts of the line are this:

  1. the bundle identifier
  2. bundle version
  3. jar file name, relative to the install location
  4. start level (usually just set it to 4)
  5. whether or not to auto-start your bundle, change this to true.

So, just add a line like this in your bundles.info and you should be good to go.

梦幻的心爱 2024-12-21 06:25:00

安装并启动的捆绑包应在下次启动时启动。

当框架尝试启动捆绑包并且它保持在“已解决”状态时,激活器可能会引发异常。检查日志。也许捆绑包不能很好地处理启动时尚不可用的服务和资源。

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.

青芜 2024-12-21 06:25:00

这是解决这个问题的另一种方法。比使用简单的配置器有点混乱(请参阅我的其他答案),但它应该更广泛适用。

在文件configuration/config.ini中,应该有一个属性osgi.bundles。此属性采用逗号分隔的包列表,以在 osgi 实例中使用。该属性如下所示:

osgi.bundles=file:/path/to/bundle,file:/path/to/other/bundle@1\:start

@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:

osgi.bundles=file:/path/to/bundle,file:/path/to/other/bundle@1\:start

The @1 is the start level of the bundle and :start means that the bundle should be autostarted.

氛圍 2024-12-21 06:25:00

我不确定我是否正确回答了你的问题。但我会尝试一下:

  1. 为什么你要尝试安装与应用程序无关的捆绑包/插件。如果你的插件/捆绑包与正在运行的应用程序环境无关,那么只需使用 eclispe 环境来启动捆绑包需要其他插件。

  2. 我认为这里发生的事情是你的包被延迟加载。如果应用程序插件不使用该捆绑包,那就有意义了。

  3. 如果您确实想让捆绑包与您的应用程序一起启动,您可以做的是,

找到配置文件列出了 RCP 应用程序中捆绑包的所有启动信息。

*这可以是config.ini文件
*或bundles.info 文件(如果应用程序使用simpleconfigurator)

将您的捆绑包信息插入配置文件之一。 (如果您想立即启动,则需要设置一个参数 - 'true')

HTH,
——普拉迪普

I'm not sure weather i got your question right. But i will give a try:

  1. 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.

  2. 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.

  3. 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

不羁少年 2024-12-21 06:25:00

创建另一个插件,该插件:

  1. 侦听包生命周期事件(使用 BundleListener)。
  2. 记录添加的捆绑包。
  3. 启动时,查找上次启动的记录并启动其中列出的捆绑包。

Create another plugin which:

  1. Listens to bundle lifecycle events (using BundleListener).
  2. Records added bundles.
  3. When started, looks for records from last launch and starts bundles listed there.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文