[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform] Re: How do I disable my own plugin at start up time?

Throwing an exception during startup is a definite way of stopping a bundle. But this won't work once your bundle has been started.
Calling stop of your bundle will shut your bundle down but I'm not sure it will work if you have a perspective or view or some resource from your plugin currently open/inuse. (You'll have to try to see what happend :) )


Some things to consider:
If checking for proper operation takes long then start is not the right point of doing it. Start should simply startup the bundle and not take too long or else the framework might think your bundle crashed and simply skip it. A better way is to use a proxy that will check for proper operation when the plugins functionality is first accessed.


If this error state you are talking about can be resolved while the plugin is running I would suggest to use a custom error flag and report upon that as long as things are not in proper state. Once they reach proper state simply reset the error flag and the user can continue working. IMHO This is a much more user friendly approach.
This also encompasses that your views, perspectives and editors know how to handle this error state.


Regards
Stefan

Farokh Morshed schrieb:
There is another similar case to this:

While our plugin is being used, it may discover that something catastrophic has happened. For example a server that it constantly talks to has closed its socket connection (more than likely user shut down the server).

What's the best way to "disable" our plugin now? Is there an API to call that effectively calls the plugin's stop method? Should I just call the stop method? Of course, I can pop up a message and say that something has gone wrong. The question is, what should I do after that. I suppose I can set a flag that every point of use (of the plugin) can check and pop up an error message, etc.

I can try all this, but if someone has solved this problem before, I would appreciate a heads up.