How to change Eclipse Preferences programmatically

前端 未结 1 1027
余生分开走
余生分开走 2021-01-07 09:10

What approach should be to change Eclipse Preferences?

They are stored in /.metadata/.plugin/org.eclipse.core.runtime/.settings

But I hope t

相关标签:
1条回答
  • 2021-01-07 09:39

    Somewhat confusingly there are several APIs a plugin can use for preferences.

    If your plugin activator extends AbstractUIPlugin then you can call

    IPreferenceStore prefStore = getPreferenceStore();
    

    in the activator to get the preference store for your plugin.

    You can also use

    IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode("node id");
    

    to get a slightly different interface to the preferences.

    There is also the org.eclipse.equinox.preferences.preferences extension point which lets you define an 'initializer' to set the default values for preferences.

    0 讨论(0)
提交回复
热议问题