views:

14

answers:

0

I'm trying to build an Eclipse RCP application, and in the process, we're trying to set the application to automatically update. We're trying to have it automatically set the right preferences in the Preferences -> Install/Update -> Automatic Updates page.

I've set all of the preferences I want in the plugin_customization.ini file for our .product (such as org.eclipse.equinox.p2.ui.sdk.scheduler/download=true), and almost all of them work. However, one preference seems to not get set automatically: this is the org.eclipse.equinox.p2.ui.sdk.scheduler/enabled preference (the one referred to by the "Automatically find new updates and notify me" checkbox on the AutomaticUpdatesPreferencePage. Digging into the source code, I understand why it doesn't set it correctly, but I'm not sure how to get around it.

Here's essentially why it doesn't work: In the last line of the AutomaticUpdatePlugin.start method, it calls

PreferenceInitializer.migratePreferences();

As it's the start method for the plugin, this occurs before any of the preferences are read from the plugin_customization.ini. migratePreferences tries to migrate this preference, which was in a different place in 3.4 and 3.3. Inside AutomaticUpdatePlugin, there's a hidden "migrated34Prefs" preference which checks to see if it's performed this migration: this migration sets the value of the enabled preference to false, so if I could somehow stop it from performing this migration (since I know there's going to be no migration from 3.3 or 3.4, as we're just built on top of 3.5), everything would work fine. The default value is set correctly via the plugin_customization.ini, but the actual value is still false (i.e. if I hit restore defaults on that preference page after opening the RCP the first time, the box goes from unchecked to checked).

Because this all occurs in the start method, I can't simply set the value of migrated34Prefs to true in the plugin_customization, because that won't even be read in until after the migration has already occurred. I know what the problem is, but I can't quite see the last step to make it so that this will be enabled by default. Is there something else I can set, or some other workaround that I haven't been able to find?