3

I am using Eclipse 3.7 (Indigo) for an Eclipse plug-in. This plugin will be packaged via the product file to be a standalone application. The installation will be a multi-user installation such as described in Scenario 2 of this link. So there will be one install area shared by many users.

Based on this answer, I figured that I can set the osgi.configuration.area to a user.home location so that each user will have their own settings. I understand how to access the preferences via code but now I would like to be able to access these via the Preferences dialog under Window in Eclipse. For all the examples I have seen, the Preferences dialog only caters to Instance scope preferences. Is there any way for me to add Configuration scope preferences to the preferencesPage.

I have also viewed this answer on stackoverflow but again this caters to Instance scope, hence I posted a separate question.

Community
  • 1
  • 1
nbz
  • 3,806
  • 3
  • 28
  • 56
  • Somehow you need to get this value set in the .ini file -Declipse.pluginCustomization=cwide.properties in runtime based on user.home, maybe if user.home is a valid value in the ini customize it to point to user.home/preferences.properties? – Duncan Krebs Nov 06 '12 at 22:37
  • Sorry, I am not sure what you mean by your comment... is that related to the preferences page? – nbz Nov 07 '12 at 10:58

1 Answers1

1

Your preference page is a subclass of PreferencePage (most likely a subclass of FieldEditorPreferencePage).

By implementing the IWorkbenchPreferencePage interface, you can implement the init method and set a custom PreferenceStore to be used in your implementation.

For example

public void init(IWorkbench workbench) {
    setPreferenceStore(
            new ScopedPreferenceStore(ConfigurationScope.INSTANCE, 
                    "com.nem.plugin") );
    setDescription("A preference page using configuration scope");
}
tkotisis
  • 3,442
  • 25
  • 30
  • This is actually what I eventually implemented and for my performOK() and performDefaults(), I use ConfigurationScope.INSTANCE.get() and put(), wherever necessary. Thank you! – nbz Nov 12 '12 at 14:38