Friday, November 16, 2007

Eclipse-LazyStart and testing plugins

Once again I've made a stupid mistake. I was supposed to add some functionality, and I've started from testing what I did. To my surprise the plugin's start method, i was depended on (lets call it org.hsia), wasn't called. It was called during the normal launch.
My first move was changing org.hsia Eclipse-LazyStart to false.
"The Eclipse-LazyStart header is used to specify if a bundle should be started before the first class or resource is accessed from that bundle" so, I thought if lazy start is false plugin will be started during the platform start - wrong (thanks Chris).
The problem in my case was that I didn't call any of the org.hsia classes. Solution in this case is simple, set org.hsia Eclipse-LazyStart to true and call:

public static void setUpEditor() {
//force Editor activator to be called

in the test.
Why I've posted that. Maybe you have the same problem, and somentimes is better to lern on sbd else mistakes :)


Boris Bokowski said...

Note that if you need to start a bundle eagerly, this is usually a sign that you should think about your design again and try to find a way to be more "lazy".

Bartek Michalik said...

yes you're right, and obviously there was a problem in design in our case. code for configuring teneo was in the wrong place.