在IPreferenceStore类中有两个类型为Properties属性,分别为properties,defaultProperties,第一个是用来存储IPreference Page中的设置,第二个是用来存储IPreference Page中的默认设置。
但是,在IPreferenceStore的构造函数中,将defaultProperties的引用传给properties。这就是为什么调用getXXX()方法可以获取defaultProperties默认值的原因。
public PreferenceStore() {
defaultProperties = new Properties();
properties = new Properties(defaultProperties);
}
Properties的构造函数:
在调用setDefault和getDefaultXXX方法时,在从defaultProperties中设置和获取值。public Properties(Properties defaults) { this.defaults = defaults; }
在调用setValue和getXXX方法时,在从