[英]How do I access general eclipse preferences in my own plugin
我想在我的插件中獲得常規控制台屬性的價值。 我怎樣才能做到這一點?
我想我應該做這樣的事情:
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
接口中列出,但這是一個內部類,因此不應使用。
這些值是
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);
您可以使用ID訪問首選項:
來自org.eclipse.debug.internal.ui.preferences.IDebugPreferenceConstants
ID:
"org.eclipse.debug.ui.errorColor"
"org.eclipse.debug.ui.outColor"
"org.eclipse.debug.ui.inColor"
"org.eclipse.debug.ui.consoleBackground"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.