/** * Sets the current value of the property with the given name back * to its default value. Has no effect if the property does not have * its own current value. The given name must not be <code>null</code>. * <p> * Note that the recommended way of re-initializing a property to the * appropriate default value is to call <code>setToDefault</code>. * This is implemented by removing the named value from the object, * thereby exposing the default value. * </p> * <p> * A property change event is always reported. In the event * object, the property name is the name of the property, and the * old and new values are either strings, or <code>null</code> * indicating the default-default value. * </p> * * @param name the name of the property */ public void setToDefault(String name) { Object oldPropertyValue = properties.remove(name); if (oldPropertyValue != null) { dirty = true; } String newValue = defaultProperties.getProperty(name, null); // n.b. newValue == null if there is no default value // can't determine correct default-default without knowing type firePropertyChangeEvent(name, oldPropertyValue, newValue); }
firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value));
firePropertyChangeEvent(name, new Double(oldValue), new Double(value));
firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
firePropertyChangeEvent(name, oldValue, value);
firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
/** * Sets the current value of the property with the given name back * to its default value. Has no effect if the property does not have * its own current value. The given name must not be <code>null</code>. * <p> * Note that the recommended way of re-initializing a property to the * appropriate default value is to call <code>setToDefault</code>. * This is implemented by removing the named value from the object, * thereby exposing the default value. * </p> * <p> * A property change event is always reported. In the event * object, the property name is the name of the property, and the * old and new values are either strings, or <code>null</code> * indicating the default-default value. * </p> * * @param name the name of the property */ public void setToDefault(String name) { Object oldPropertyValue = properties.remove(name); if (oldPropertyValue != null) { dirty = true; } String newValue = defaultProperties.getProperty(name, null); // n.b. newValue == null if there is no default value // can't determine correct default-default without knowing type firePropertyChangeEvent(name, oldPropertyValue, newValue); }
/** * Sets the current value of the property with the given name back * to its default value. Has no effect if the property does not have * its own current value. The given name must not be <code>null</code>. * <p> * Note that the recommended way of re-initializing a property to the * appropriate default value is to call <code>setToDefault</code>. * This is implemented by removing the named value from the object, * thereby exposing the default value. * </p> * <p> * A property change event is always reported. In the event * object, the property name is the name of the property, and the * old and new values are either strings, or <code>null</code> * indicating the default-default value. * </p> * * @param name the name of the property */ public void setToDefault(String name) { Object oldPropertyValue = properties.remove(name); if (oldPropertyValue != null) { dirty = true; } String newValue = defaultProperties.getProperty(name, null); // n.b. newValue == null if there is no default value // can't determine correct default-default without knowing type firePropertyChangeEvent(name, oldPropertyValue, newValue); }
/** * Sets the current value of the property with the given name back * to its default value. Has no effect if the property does not have * its own current value. The given name must not be <code>null</code>. * <p> * Note that the recommended way of re-initializing a property to the * appropriate default value is to call <code>setToDefault</code>. * This is implemented by removing the named value from the object, * thereby exposing the default value. * </p> * <p> * A property change event is always reported. In the event * object, the property name is the name of the property, and the * old and new values are either strings, or <code>null</code> * indicating the default-default value. * </p> * * @param name the name of the property */ public void setToDefault(String name) { Object oldPropertyValue = properties.remove(name); if (oldPropertyValue != null) { dirty = true; } String newValue = defaultProperties.getProperty(name, null); // n.b. newValue == null if there is no default value // can't determine correct default-default without knowing type firePropertyChangeEvent(name, oldPropertyValue, newValue); }
firePropertyChangeEvent(name, oldValue ? Boolean.TRUE : Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
else getPluginPreferences(true).putDouble(name, value); firePropertyChangeEvent(name, oldValue, newValue); } finally { notify = true;
else getPluginPreferences(true).put(name, value); firePropertyChangeEvent(name, oldValue, value); } finally { notify = true;
else getPluginPreferences(true).put(name, value); firePropertyChangeEvent(name, oldValue, value); } finally { notify = true;
public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) { // if we are the ones making this change, then don't broadcast if (!notify) return; Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); String key = event.getKey(); if (newValue == null) newValue = getDefault(key, oldValue); else if (oldValue == null) oldValue = getDefault(key, newValue); firePropertyChangeEvent(key, oldValue, newValue); }
public void preferenceChange(IEclipsePreferences.PreferenceChangeEvent event) { // if we are the ones making this change, then don't broadcast if (!notify) return; Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); String key = event.getKey(); if (newValue == null) newValue = getDefault(key, oldValue); else if (oldValue == null) oldValue = getDefault(key, newValue); firePropertyChangeEvent(key, oldValue, newValue); }
else getPluginPreferences(true).putLong(name, value); firePropertyChangeEvent(name, oldValue, newValue); } finally { notify = true;
else getPluginPreferences(true).putLong(name, value); firePropertyChangeEvent(name, oldValue, newValue); } finally { notify = true;
else getPluginPreferences(true).putBoolean(name, value); firePropertyChangeEvent(name, oldValue, newValue); } finally { notify = true;
else getPluginPreferences(true).putBoolean(name, value); firePropertyChangeEvent(name, oldValue, newValue); } finally { notify = true;