Skip
Skip

Reputation: 6531

Eclipse RCP - change plugin.xml programmatically? Reload?

Edit:
What I want to do, is adding preferences-pages to the preferences-menu in an Rclipse-RCP 3.7 application programmatically. Unfortuanately this seems not to work programmatically, as described in this post.

As a solution I think about creating a special plugin, which will maintain the preferences. This plugin should declare all preference-pages in it's plugin.xml and uninstall/install itself to apply the changes in the preferences-menu.

Question:

Is there a possibility to

  1. change the plugin's own plugin.xml programmatically?
  2. is there a possibility to update the plugin programmatically, to reload the new settings from plugin.xml ?

Upvotes: 3

Views: 2006

Answers (1)

Paul Webster
Paul Webster

Reputation: 10654

It would be helpful to understand the problem you are trying to solve, instead of what you are doing.

In general, there's no easy way to do what you want.

You can force a reload of your plugin.xml by using OSGi to uninstall and re-install your bundle. See org.osgi.framework.Bundle.uninstall(). But depending on the extensions contributed by the plugin.xml, not extension point consumers are written to be dynamic aware.

The other option for an RCP app is to contribute extensions using org.eclipse.core.runtime.IExtensionRegistry.addContribution(InputStream, IContributor, boolean, String, ResourceBundle, Object). This is great for dynamic additions, it's less reliable for removing extensions, and the same caveat applies (how dynamic-aware is the consumer of the extension point). You use it in RCP apps by setting the user token to null.

Upvotes: 3

Related Questions