Friday, July 15, 2011

Change Eclipse plugin_customization.ini via feature

Eclipse has an elaborate hierarchical preference mechanism:
  • Plugins have a preferences.ini.
  • The product can override the settings of any plugin via a plugin_customization.ini file
  • Finally you can provide your own defaults via a command-line option -pluginCustomization /path/to/my/settings.ini.
When you create products, you typically include a plugin_customization.ini file in your product.

What if you need to create products with different settings?

Can you put the plugin_customization.ini file into fragments for your product plugin? That doesn't work. Plugin customization.ini files in fragments seem to be ignored.

But here's what you can do: Fake localization.

In your product plugin, have a plugin_customization.ini file that looks like this:

some.plugin/some_setting=%some_value

Then, in a fragment of the product plugin, place a plugin_customization.properties file that contains

some_value=Value A

In another fragment, you can have

some_value=Value B

By loading the appropriate fragments, for example from an update site, you can now install the settings that you want!

1 comment:

  1. Thank you! This saved me much time in not having to try it out myself.

    My problem was that I needed different plugin customization for different operating systems. With your solution and corresponding platform filters in the fragments it worked like a charm.

    ReplyDelete