Need to reset a plugin back to INSTALLED state [message #528440] |
Tue, 20 April 2010 14:20 |
|
Hi,
We have a plugin which contributes views, menus (via Command extension)
and StatusBar updates.
The plugin needs to be able to be stopped if commanded by the user, and
returned ideally to either the INSTALLED state or the lazy start state.
I found I can use this approach to get the plugin to stopped state but
the contributed resources are still available even though they can do
nothing since the plugin has stopped:
Bundle bundle = Activator.getDefault().getBundle();
bundle.stop();
It's also possible to bundle.uninstall() but how do we get the plugin
reinstalled?
Thanks for any suggestions,
Dilton
|
|
|
|
Re: Need to reset a plugin back to INSTALLED state [message #528542 is a reply to message #528509] |
Tue, 20 April 2010 20:57 |
|
On Tue, 20 Apr 2010 14:42:47 -0400, Paul Webster wrote:
> You're seeing that the eclipse extension registry doesn't match the OSGi
> bundle states. Neil Bartlett has written a number of
> articles/blogs/talks about this subject.
>
> The only way to get extension contributions (actionSets, menus,
> preference pages, etc) to disappear is to uninstall the bundle as you
> found out. The UI tries to respond dynamically to these removals,
> although it is not always successful.
>
> To install you have to use something like
> org.osgi.framework.BundleContext.installBundle(String) and then
> PackageAdmin to refresh the packages/classes.
>
> I've seen test utilities do it, like
> org.eclipse.ui.tests.dynamicplugins.TestInstallUtil from the
> org.eclipse.ui.tests bundle (/cvsroot/eclipse).
>
> PW
Thanks for clearing things up for me Paul. I've verified
the refresh part using the OSGi console by adding -console
to the Run Configuration.
I still need to figure out how to get Eclipse to re-install when
the user wants to work with the plugin again, perhaps your
suggestion on how test utilities do it is the right way to go.
Perhaps I'll add a starter plugin that the user uses to start the
main plugin.
Thanks for the tips.
Dilton
|
|
|
Powered by
FUDForum. Page generated in 0.03015 seconds