import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
+//import org.eclipse.jface.util.PropertyChangeEvent;
/**
* An overlaying preference store.
}
};
- private class PropertyListener implements IPropertyChangeListener {
-
- /*
- * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- OverlayKey key = findOverlayKey(event.getProperty());
- if (key != null)
- propagateProperty(fParent, key, fStore);
- }
- };
+// private class PropertyListener implements IPropertyChangeListener {
+//
+// /*
+// * @see IPropertyChangeListener#propertyChange(PropertyChangeEvent)
+// */
+// public void propertyChange(PropertyChangeEvent event) {
+// OverlayKey key = findOverlayKey(event.getProperty());
+// if (key != null)
+// propagateProperty(fParent, key, fStore);
+// }
+// };
private IPreferenceStore fParent;
private OverlayKey[] fOverlayKeys;
- private PropertyListener fPropertyListener;
+ //private PropertyListener fPropertyListener;
public OverlayPreferenceStore(IPreferenceStore parent,
OverlayKey[] overlayKeys) {
return (findOverlayKey(key) != null);
}
- private void propagateProperty(IPreferenceStore orgin, OverlayKey key,
- IPreferenceStore target) {
-
- if (orgin.isDefault(key.fKey)) {
- if (!target.isDefault(key.fKey))
- target.setToDefault(key.fKey);
- return;
- }
-
- TypeDescriptor d = key.fDescriptor;
- if (BOOLEAN == d) {
-
- boolean originValue = orgin.getBoolean(key.fKey);
- boolean targetValue = target.getBoolean(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (DOUBLE == d) {
-
- double originValue = orgin.getDouble(key.fKey);
- double targetValue = target.getDouble(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (FLOAT == d) {
-
- float originValue = orgin.getFloat(key.fKey);
- float targetValue = target.getFloat(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (INT == d) {
-
- int originValue = orgin.getInt(key.fKey);
- int targetValue = target.getInt(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (LONG == d) {
-
- long originValue = orgin.getLong(key.fKey);
- long targetValue = target.getLong(key.fKey);
- if (targetValue != originValue)
- target.setValue(key.fKey, originValue);
-
- } else if (STRING == d) {
-
- String originValue = orgin.getString(key.fKey);
- String targetValue = target.getString(key.fKey);
- if (targetValue != null && originValue != null
- && !targetValue.equals(originValue))
- target.setValue(key.fKey, originValue);
-
- }
- }
-
- public void propagate() {
- for (int i = 0; i < fOverlayKeys.length; i++)
- propagateProperty(fStore, fOverlayKeys[i], fParent);
- }
+// private void propagateProperty(IPreferenceStore orgin, OverlayKey key,
+// IPreferenceStore target) {
+//
+// if (orgin.isDefault(key.fKey)) {
+// if (!target.isDefault(key.fKey))
+// target.setToDefault(key.fKey);
+// return;
+// }
+//
+// TypeDescriptor d = key.fDescriptor;
+// if (BOOLEAN == d) {
+//
+// boolean originValue = orgin.getBoolean(key.fKey);
+// boolean targetValue = target.getBoolean(key.fKey);
+// if (targetValue != originValue)
+// target.setValue(key.fKey, originValue);
+//
+// } else if (DOUBLE == d) {
+//
+// double originValue = orgin.getDouble(key.fKey);
+// double targetValue = target.getDouble(key.fKey);
+// if (targetValue != originValue)
+// target.setValue(key.fKey, originValue);
+//
+// } else if (FLOAT == d) {
+//
+// float originValue = orgin.getFloat(key.fKey);
+// float targetValue = target.getFloat(key.fKey);
+// if (targetValue != originValue)
+// target.setValue(key.fKey, originValue);
+//
+// } else if (INT == d) {
+//
+// int originValue = orgin.getInt(key.fKey);
+// int targetValue = target.getInt(key.fKey);
+// if (targetValue != originValue)
+// target.setValue(key.fKey, originValue);
+//
+// } else if (LONG == d) {
+//
+// long originValue = orgin.getLong(key.fKey);
+// long targetValue = target.getLong(key.fKey);
+// if (targetValue != originValue)
+// target.setValue(key.fKey, originValue);
+//
+// } else if (STRING == d) {
+//
+// String originValue = orgin.getString(key.fKey);
+// String targetValue = target.getString(key.fKey);
+// if (targetValue != null && originValue != null
+// && !targetValue.equals(originValue))
+// target.setValue(key.fKey, originValue);
+//
+// }
+// }
+
+// public void propagate() {
+// for (int i = 0; i < fOverlayKeys.length; i++)
+// propagateProperty(fStore, fOverlayKeys[i], fParent);
+// }
private void loadProperty(IPreferenceStore orgin, OverlayKey key,
IPreferenceStore target, boolean forceInitialization) {
loadProperty(fParent, fOverlayKeys[i], fStore, true);
}
- public void loadDefaults() {
- for (int i = 0; i < fOverlayKeys.length; i++)
- setToDefault(fOverlayKeys[i].fKey);
- }
-
- public void start() {
- if (fPropertyListener == null) {
- fPropertyListener = new PropertyListener();
- fParent.addPropertyChangeListener(fPropertyListener);
- }
- }
-
- public void stop() {
- if (fPropertyListener != null) {
- fParent.removePropertyChangeListener(fPropertyListener);
- fPropertyListener = null;
- }
- }
+// public void loadDefaults() {
+// for (int i = 0; i < fOverlayKeys.length; i++)
+// setToDefault(fOverlayKeys[i].fKey);
+// }
+
+// public void start() {
+// if (fPropertyListener == null) {
+// fPropertyListener = new PropertyListener();
+// fParent.addPropertyChangeListener(fPropertyListener);
+// }
+// }
+
+// public void stop() {
+// if (fPropertyListener != null) {
+// fParent.removePropertyChangeListener(fPropertyListener);
+// fPropertyListener = null;
+// }
+// }
/*
* @see IPreferenceStore#addPropertyChangeListener(IPropertyChangeListener)