Uninstall an eclipse plugin programmatically [message #1738445] |
Tue, 19 July 2016 23:12 |
|
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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03710 seconds