public void setComponents(EnigmaSettings es) {
    sDef.setCode(es.definitions);
    sGlobLoc.setCode(es.globalLocals);
    sInit.setCode(es.initialization);
    sClean.setCode(es.cleanup);

    for (Entry<String, String> entry : es.options.entrySet()) {
      Option opt = options.get(entry.getKey());
      if (opt != null) opt.setValue(entry.getValue());
    }

    changing = true;
    for (Entry<JComboBox, String> box : targets.entrySet()) {
      TargetSelection targ = es.targets.get(box.getValue());
      if (targ != null) box.getKey().setSelectedItem(targ);
      box.getKey()
          .setFont(
              box.getKey()
                  .getFont()
                  .deriveFont(
                      box.getValue().equals(TargetHandler.COMPILER) ? Font.BOLD : Font.PLAIN));
    }
    changing = false;

    userPicks.clear();
    userPicks.put(TargetHandler.COMPILER, es.targets.get(TargetHandler.COMPILER));

    for (Entry<ExtensionSetting, Boolean> entry : extensions.entrySet())
      entry.setValue(es.extensions.contains(entry.getKey().path)); // writes through to map
  }
  public void commitChanges() {
    res.definitions = sDef.getCode();
    res.globalLocals = sGlobLoc.getCode();
    res.initialization = sInit.getCode();
    res.cleanup = sClean.getCode();

    res.options.clear();
    for (Entry<String, Option> entry : options.entrySet())
      res.options.put(
          entry.getKey(), entry.getValue() == null ? null : entry.getValue().getValue());

    res.targets.clear();
    for (Entry<JComboBox, String> box : targets.entrySet())
      res.targets.put(box.getValue(), (TargetSelection) box.getKey().getSelectedItem());

    res.extensions.clear();
    for (Entry<ExtensionSetting, Boolean> entry : extensions.entrySet())
      if (entry.getValue()) res.extensions.add(entry.getKey().path);
  }