views:

593

answers:

2

Anyone know of a way to guarantee plugin startup order? I have a plugin that I want to develop that will provide runtime configuration information to a 3rd-party plugin that I can't modify.

So, I want to make sure my plugin always runs to completion before the 3rd-party.

Anyone?

Eclipse 3.3, BTW.

A: 

Check out start level or start level service. Though it seems it is not quite straightforward to use in Eclipse.

starblue
+1  A: 

The OSGi way to do it is to use start levels in config.ini. But for Eclipse plugins they typically aren't listed there but are automatically configured by the configurator bundle.

Honestly you're not really supposed to do this. OSGi bundles (which means, Eclipse plugins) are supposed to be able to be started in any order, in general. Use the service registry to get handles to whatever you need as soon as they become available.

Another way to look at it: what's causing the 3rd-party plugin to load (since Eclipse favors lazy loading of plugins)? Perhaps you can hook into the same mechanism.

If you get desperate you can force yourself to be started using the Eclipse startup extension point. Just remember that a) this is the nuclear option, b) the user has UI under Preferences to turn off your startup extension, c) you don't get to control the ordering of the startup extension point, so if your 3rd-party plugin uses it too, you are SOL.

John Stoneham