如何以编程方式更改Eclipse Preferences [英] How to change Eclipse Preferences programmatically
问题描述
什么方法应该更改Eclipse首选项?
它们存储在< workspace> /。metadata / .plugin / org.eclipse.core.runtime / .settings
但是我希望找到Java API并发现任何偏好ID。
如果您的插件激活器扩展了 AbstractUIPlugin
那么你可以调用
IPreferenceStore prefStore = getPreferenceStore();
在激活器中获取您的插件的首选商店。
您还可以使用
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode node id);
以获得与首选项稍微不同的界面。
还有一个 org.eclipse.equinox.preferences.preferences
扩展点,可以让你定义一个'initializer'来设置首选项的默认值。 p>
What approach should be to change Eclipse Preferences?
They are stored in <workspace>/.metadata/.plugin/org.eclipse.core.runtime/.settings
But I hope to find Java API and a way to discover any preference ID.
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.
这篇关于如何以编程方式更改Eclipse Preferences的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!