I'm working on an eclipse plugin that extends an existing plugin. The plugin I am extending defines some default preferences which can be changed at runtime via the preferences menu. I want to have some of those properties changed for the users of my plugin. For instance: A property in the plugin I'm extending exists that isn't checked (i.e. false). I want it to be checked for my plugin by default. How can I do that?
Not a duplicate of Can my Eclipse plugin change preferences f开发者_如何学JAVArom other plugins?, because that question aimed at creating a new prefence page that changes other plugin's preferences (as far as I understood it). I don't want to create a new preference page, I simply want to change the default settings.
You need to know the plug-in ID and the preference name, but then the following code should do the trick:
IPreferenceStore s = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.ui");
ss.setValue("SHOW_MEMORY_MONITOR", true);
This exact code will enable the memory monitor in the status bar...
精彩评论