Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Uninstall an eclipse plugin programmatically
Uninstall an eclipse plugin programmatically [message #1738445] Tue, 19 July 2016 23:12 Go to next message
neto Mising name is currently offline neto Mising nameFriend
Messages: 33
Registered: July 2009
Member
I'm developing an eclipse plugin that when the user clicks a button, another plugin is uninstalled programmatically.

I tried:
Bundle b1 = Platform.getBundle(bundleId);
b1.uninstall();


The plugin stops to work. However, the graphical elements are not deleted.

Then I tried:

http://stackoverflow.com/questions/9927400/how-do-i-easily-query-a-running-eclipse-for-its-installed-features?rq=1

I could find the corresponding IInstallableUnit

Then I use the following code:
private void scheduleUninstallOperationJob(
	        Collection<? extends IVersionedId> toUninstall) 
	{
	    OperationFactory oFactory = new OperationFactory();
	    Collection<URI> repos = null;
	    UninstallOperation op = null;
	    try {
	        op = oFactory.createUninstallOperation(toUninstall, repos, null);
	    } catch (ProvisionException e) {
	        e.printStackTrace();
	    } 
	    IStatus result = op.resolveModal(null);
	    if (result.isOK()) {
	        op.getProvisioningJob(null).run(null);
	    }
	}

In this case, both plugin and UI are not deleted.

Finally, somebody can help me and say how to uninstall or even disable an eclipse plugin programmatically from another plugin.

Thanks in advance.
Re: Uninstall an eclipse plugin programmatically [message #1738509 is a reply to message #1738445] Wed, 20 July 2016 13:09 Go to previous message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Uninstalling a bundle should be all that is needed. If the bundle exports packages then you likely will want to perform a refreshBundles opertation [1]. But it sounds like the e4 UI layer is not recognizing that the bundle with the UI elements is going away. I would ask this on the eclipse e4 forum.



[1] https://osgi.org/javadoc/r6/core/org/osgi/framework/wiring/FrameworkWiring.html#refreshBundles(java.util.Collection,%20org.osgi.framework.FrameworkListener...)
Previous Topic:Missing code signer information for third party JAR
Next Topic:HttpSessionAdapter
Goto Forum:
  


Current Time: Sat Oct 12 10:25:49 GMT 2024

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

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

Back to the top