}
}
+ @Override
+ public String getString(String name)
+ {
+ switch (name)
+ {
+ default:
+ throw new IllegalArgumentException("Unknown string preference name: " + name);
+ }
+ }
+
@Override
public ColorDefinition getColorDefinition(String name)
{
}
}
+ @Override
+ public String getString(String name)
+ {
+ switch (name)
+ {
+ default:
+ throw new IllegalArgumentException("Unknown double preference name: " + name);
+ }
+ }
+
@Override
public ColorDefinition getColorDefinition(String name)
{
private final ListenerManager<Boolean> booleanListeners;
private final ListenerManager<Integer> intListeners;
private final ListenerManager<Double> doubleListeners;
+ private final ListenerManager<String> stringListeners;
private final ListenerManager<ColorDefinition> colorDefinitionListeners;
protected EclipsePreferences(ITheme theme, IPreferenceStore prefs, Preferences defaultPrefs)
this.booleanListeners = new ListenerManager<>(this::getBoolean);
this.intListeners = new ListenerManager<>(this::getInt);
this.doubleListeners = new ListenerManager<>(this::getDouble);
+ this.stringListeners = new ListenerManager<>(this::getString);
this.colorDefinitionListeners = new ListenerManager<>(this::getColorDefinition);
}
return prefs.getDouble(name);
}
+ @Override
+ public String getString(String name)
+ {
+ prefs.setDefault(name, defaultPrefs.getString(name));
+ return prefs.getString(name);
+ }
+
@Override
public ColorDefinition getColorDefinition(String name)
{
doubleListeners.removeListener(name, listener);
}
+ @Override
+ public void addStringListener(String name, Consumer<String> listener)
+ {
+ stringListeners.addListener(name, listener);
+ }
+
+ @Override
+ public void removeStringListener(String name, Consumer<String> listener)
+ {
+ stringListeners.removeListener(name, listener);
+ }
+
@Override
public void addColorDefinitionListener(String name, Consumer<ColorDefinition> listener)
{
// Adding / removing listeners. All are no-ops, since DefaultPreferences are immutable.
//@formatter:off
- @Override public void addBooleanListener(String name, Consumer<Boolean> listener) {/**/}
- @Override public void removeBooleanListener(String name, Consumer<Boolean> listener) {/**/}
- @Override public void addIntListener(String name, Consumer<Integer> listener) {/**/}
- @Override public void removeIntListener(String name, Consumer<Integer> listener) {/**/}
- @Override public void addDoubleListener(String name, Consumer<Double> listener) {/**/}
- @Override public void removeDoubleListener(String name, Consumer<Double> listener) {/**/}
- @Override public void addColorDefinitionListener(String name, Consumer<ColorDefinition> listener) {/**/}
- @Override public void removeColorDefinitionListener(String name, Consumer<ColorDefinition> listener) {/**/}
+ @Override public final void addBooleanListener(String name, Consumer<Boolean> listener) {/**/}
+ @Override public final void removeBooleanListener(String name, Consumer<Boolean> listener) {/**/}
+ @Override public final void addIntListener(String name, Consumer<Integer> listener) {/**/}
+ @Override public final void removeIntListener(String name, Consumer<Integer> listener) {/**/}
+ @Override public final void addDoubleListener(String name, Consumer<Double> listener) {/**/}
+ @Override public final void removeDoubleListener(String name, Consumer<Double> listener) {/**/}
+ @Override public final void addStringListener(String name, Consumer<String> listener) {/**/}
+ @Override public final void removeStringListener(String name, Consumer<String> listener) {/**/}
+ @Override public final void addColorDefinitionListener(String name, Consumer<ColorDefinition> listener) {/**/}
+ @Override public final void removeColorDefinitionListener(String name, Consumer<ColorDefinition> listener) {/**/}
//@formatter:on
}
\ No newline at end of file
public void removeDoubleListener(String name, Consumer<Double> listener);
+ public String getString(String name);
+
+ public void addStringListener(String name, Consumer<String> listener);
+
+ public void removeStringListener(String name, Consumer<String> listener);
+
public ColorDefinition getColorDefinition(String name);
public void addColorDefinitionListener(String name, Consumer<ColorDefinition> listener);