我想获取插件中常规控制台属性的值。 我怎样才能做到这一点?
我想我应该做这样的事情:
IPreferenceStore store = ScriptUIActivator.getDefault().getPreferenceStore();
store.getDefaultInt(preferenceName);
但是“preferenseName”是什么?我必须使用哪一家偏好商店。 http://i.stack.imgur.com/IqSuE.jpg
最佳答案
这些首选项位于org.eclipse.debug.ui
插件中
您可以使用
访问首选项存储IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.debug.ui");
首选项值在 IDebugPreferenceConstants
接口(interface)中列出,但这是一个内部类,因此不应使用。
这些值为
public static final String CONSOLE_SYS_ERR_COLOR= "org.eclipse.debug.ui.errorColor";
public static final String CONSOLE_SYS_OUT_COLOR= "org.eclipse.debug.ui.outColor";
public static final String CONSOLE_SYS_IN_COLOR= "org.eclipse.debug.ui.inColor";
public static final String CONSOLE_BAKGROUND_COLOR= "org.eclipse.debug.ui.consoleBackground";
由于这些值是内部值,因此可能会更改,恕不另行通知。
首选项值是 RGB 字符串,您可以使用 PreferenceConverter
来处理这些:
RGB color = PreferenceConverter.getColor(preferenceStore, key);
PreferenceConverter.setValue(preferenceStore, key, rgb);
关于java - 如何在我自己的插件中访问常规 Eclipse 首选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30706342/