Ejemplo n.º 1
0
  /** Remebers the update policy preference settings on the JOSM preferences */
  public void rememberInPreferences() {

    // remember policy for version based update
    //
    for (Policy p : Policy.values()) {
      if (rbVersionBasedUpatePolicy.get(p).isSelected()) {
        Main.pref.put("pluginmanager.version-based-update.policy", p.getPreferencesValue());
        break;
      }
    }

    // remember policy for time based update
    //
    for (Policy p : Policy.values()) {
      if (rbTimeBasedUpatePolicy.get(p).isSelected()) {
        Main.pref.put("pluginmanager.time-based-update.policy", p.getPreferencesValue());
        break;
      }
    }

    // remember update interval
    //
    int days = 0;
    try {
      days = Integer.parseInt(tfUpdateInterval.getText().trim());
      if (days <= 0) {
        days = 60;
      }
    } catch (NumberFormatException e) {
      days = 60;
    }
    Main.pref.putInteger("pluginmanager.time-based-update.interval", days);
  }
Ejemplo n.º 2
0
 static Policy fromPreferenceValue(String preferenceValue) {
   if (preferenceValue == null) return null;
   preferenceValue = preferenceValue.trim().toLowerCase();
   for (Policy p : Policy.values()) {
     if (p.getPreferencesValue().equals(preferenceValue)) return p;
   }
   return null;
 }