private void handlePropertyChangeEvent(IPreferenceStore childPreferenceStore, PropertyChangeEvent event) {
String property= event.getProperty();
Object oldValue= event.getOldValue();
Object newValue= event.getNewValue();
IPreferenceStore visibleStore= getVisibleStore(property);
/*
* Assume that the property is there but has no default value (its owner relies on the default-default value)
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=52827
*/
if (visibleStore == null && newValue != null)
visibleStore= childPreferenceStore;
if (visibleStore == null) {
// no visible store
if (oldValue != null)
// removal in child, last in chain -> removal in this chained preference store
firePropertyChangeEvent(event);
} else if (visibleStore == childPreferenceStore) {
// event from visible store
if (oldValue != null) {
// change in child, visible store -> change in this chained preference store
firePropertyChangeEvent(event);
} else {
// insertion in child
IPreferenceStore oldVisibleStore= null;
int i= 0;
int length= fPreferenceStores.length;
while (i < length && fPreferenceStores[i++] != visibleStore) {
// do nothing
}
while (oldVisibleStore == null && i < length) {
if (fPreferenceStores[i].contains(property))
oldVisibleStore= fPreferenceStores[i];
i++;
}
if (oldVisibleStore == null) {
// insertion in child, first in chain -> insertion in this chained preference store
firePropertyChangeEvent(event);
} else {
// insertion in child, not first in chain
oldValue= getOtherValue(property, oldVisibleStore, newValue);
if (!oldValue.equals(newValue))
// insertion in child, different old value -> change in this chained preference store
firePropertyChangeEvent(property, oldValue, newValue);
// else: insertion in child, same old value -> no change in this chained preference store
}
}
} else {
// event from other than the visible store
boolean eventBeforeVisibleStore= false;
for (int i= 0, length= fPreferenceStores.length; i < length; i++) {
IPreferenceStore store= fPreferenceStores[i];
if (store == visibleStore)
break;
if (store == childPreferenceStore) {
eventBeforeVisibleStore= true;
break;