Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Need to reset a plugin back to INSTALLED state
Need to reset a plugin back to INSTALLED state [message #528440] Tue, 20 April 2010 14:20 Go to next message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
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 #528509 is a reply to message #528440] Tue, 20 April 2010 18:42 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Need to reset a plugin back to INSTALLED state [message #528542 is a reply to message #528509] Tue, 20 April 2010 20:57 Go to previous message
Dilton McGowan II is currently offline Dilton McGowan IIFriend
Messages: 110
Registered: July 2009
Senior Member
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
Previous Topic:what does 'isv' mean in '*.doc.isv'?
Next Topic:Is it possible to stop an editor from being restored if it is open when the workbench is closed?
Goto Forum:
  


Current Time: Thu Apr 25 06:31:03 GMT 2024

Powered by FUDForum. Page generated in 0.03381 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top