【问题标题】:'Restore Defaults' Preference Page Functionality in EclipseEclipse 中的“恢复默认值”首选项页面功能
【发布时间】:2009-08-26 04:17:54
【问题描述】:

是否有一种编程方法可以实现与在 Eclipse 首选项页面中单击“恢复默认值”相同的结果?

我已经知道字段编辑器系统和偏好存储的工作原理。

谢谢! :)

【问题讨论】:

    标签: java eclipse eclipse-plugin


    【解决方案1】:

    setToDefault() of IPreferenceStore 方法似乎是一个不错的候选。

    你可以使用这个函数看到EditorsUI

    public static void useQuickDiffPreferencePage(IPreferenceStore store) {
      MarkerAnnotationPreferences.useQuickDiffPreferencePage(store);
      store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_ALWAYS_ON);
      store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE);
      store.setToDefault(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_DEFAULT_PROVIDER);
    }
    

    或者在method resetToDefaultSettings() of class HeapWalkingManager

    /**
     * Resets the preferences controlled by this manager to their default settings
     */
    public void resetToDefaultSettings(){
      JDIDebugPlugin.getDefault().getPluginPreferences().setToDefault(JDIDebugPlugin.PREF_SHOW_REFERENCES_IN_VAR_VIEW);
      JDIDebugPlugin.getDefault().getPluginPreferences().setToDefault(JDIDebugPlugin.PREF_ALL_REFERENCES_MAX_COUNT);
      JDIDebugPlugin.getDefault().getPluginPreferences().setToDefault(JDIDebugPlugin.PREF_ALL_INSTANCES_MAX_COUNT);
    }
    

    【讨论】:

    • 啊,我肯定错过了,通常的默认设置不起作用。你是救生员!谢谢!!
    • +1 为您服务(部分原因是您对我的回答的插件间谍评论,即功能规则)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-21
    • 2010-12-23
    • 1970-01-01
    • 2012-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多