Add auto-start plugins to eclipse RCP application

I have an RCP Eclipse application and I am not trying to install the plugin that I created, which should be deployed separately in the above application.

To do this, I launch the application as ./App -console , and when it stops loading, I print:

 install file://URLTOjAR/plugin.jar 

It returns me the plugin id (say 288 ), so I print later:

 start 288 

After that, the plugin works fine, but when I restart the application using ss, I only see that the plugin is only "Solved", but I would like it to be launched.

Is there a way to automate this?

+2
source share
5 answers

The installed and running bundle should be started at the next start.

The activator may throw an exception when the environment tries to start the package and remains in the RESOLVED state. Check out the logs. Perhaps the package does not cope with services, resources that are not yet available at startup.

+1
source

Since you are using the Eclipse RCP application, most likely you are using SimpleConfigurator to determine your list of installed packages. Open the file App / configuration / org.eclipse.equinox.simpleconfigurator / bundles.info

This file contains a list of installed packages, their versions and their autostart. 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 as follows:

  • package id
  • package version
  • jar file name relative to installation location
  • entry level (usually just 4)
  • whether to run your package automatically, change it to true.

So, just add such a line to your bundles.info package, and you should be fine to go.

+2
source

I'm not sure the weather is right for me. But I'll try:

  • Why are you trying to install a package / plugin that is not related to the application. If your plugin / package has nothing to do with the running application environment, just use the eclispe environment to run the package with the necessary other plugins.

  • I think what happens here is that this bunch becomes lazy. If application plugins do not use the package, this makes sense.

  • If you really want the package to start with your application, you can do this,

Locate the configuration file that will display all the information about starting the package in your RCP application.

* It can be a config.ini file * or a bundles.info file if the application uses simpleconfigurator

Paste your package information into one of the configuration files. (theres a parameter to install if you want an immediate start - "true")

NTN, --Pradeep

0
source

Create another plugin that:

  • Listens to the integration of life cycle events (using the BundleListener ).
  • Records added packages.
  • When starting, it searches for records from the last start and starts nodes there.
0
source

And here is another way to solve this problem. A bit messy than using a simple configurator (see My other answer), but it should be more widely applicable.

The configuration of the /config.ini file must have the osgi.bundles property. This property accepts a comma-separated list of bundles for use in an osgi instance. The property is as follows:

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

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

0
source

Source: https://habr.com/ru/post/945247/


All Articles