All pastes #170174 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-09-14 12:44 UTC
rendered paste body
Hi guys, when I'm using the Preferences in Eclipse i found an odd behaviour.

If I try to set a preference in the ConfigurationScope() to a value that is the default value set in the DefaultScope() of that preference, the method setValue(String, String) of the ScopedPreferenceStore class will silently remove the preference key from the ConfigurationScope() store! What obligates me to retrieve the value from the DefaultScope() preference.

Does someone out there understand why this is being accomplished this way?

Bellow is the source of the mentioned method:

/*
* (non-Javadoc)
* * @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
*      java.lang.String)
*/
public void setValue(String name, String value) {
    // Do not turn on silent running here as Strings are propagated
    if (getDefaultString(name).equals(value)) {
        getStorePreferences().remove(name); <==HERE! REMOVING MY PREF!
    } else {
        getStorePreferences().put(name, value);
    }
    dirty = true;
}

Thank you,
bruno.