result = Integer.parseInt(prefValue);
}catch(NumberFormatException e){
logger.debug("Preference value of " + name + " is not a number");
- if (prefValue == null){
- if (pref != null){
- String predicate = pref.getPredicate();
- IPreferencePredicate pred = PreferencePredicate.getByKey(predicate);
- Object defaultValue = pred.getDefaultValue();
- if (defaultValue instanceof String){
- result = Integer.valueOf((String)defaultValue);
- } else if (defaultValue instanceof Integer){
- result = (Integer)defaultValue;
- }
- }
- }
+
}
String overrideKey = createPreferenceString(createOverridePreferenceString(name));
boolean override = getPreferenceStore().getBoolean(overrideKey);
String dbSpecific = prefKey(name);
if (getPreferenceStore().contains(dbSpecific)){
result = getPreferenceStore().getInt(dbSpecific);
- }else{
- if (result == null){
- IPreferencePredicate pred = PreferencePredicate.getByKey(name);
- if (pred != null){
- if (pred.getDefaultValue() instanceof Integer){
- return (Integer)pred.getDefaultValue();
- }else if (pred.getDefaultValue() != null){
- return Integer.valueOf(pred.getDefaultValue().toString());
- }
+ }
+ }
+ if (result == null){
+ IPreferencePredicate pred = PreferencePredicate.getByKey(name);
+ if (pred != null){
+ if (pred.getDefaultValue() instanceof Integer){
+ result = (Integer)pred.getDefaultValue();
+ }else if (pred.getDefaultValue() != null){
+ try{
+ result = Integer.valueOf(pred.getDefaultValue().toString());
+ }catch(NumberFormatException e){
+ logger.debug("Preference value of " + name + " is not a number");
+ result = 0;
}
- return 0;
}
}
+ //if no default value available
+ if (result == null){
+ result = 0;
+ }
+
}
return result;