public void save(Element rootElement) {
    rootElement.setAttribute(HOST, StringUtil.notNullize(getHost()));
    rootElement.setAttribute(PORT, StringUtil.notNullize(getLiteralPort()));
    rootElement.setAttribute(USERNAME, StringUtil.notNullize(myUserName));
    rootElement.setAttribute(PRIVATE_KEY_FILE, StringUtil.notNullize(getPrivateKeyFile()));
    rootElement.setAttribute(USE_KEY_PAIR, Boolean.toString(myAuthType == AuthType.KEY_PAIR));
    rootElement.setAttribute(USE_OPENSSH_CONFIG, Boolean.toString(isOpenSshConfigUsageForced()));
    // the old `USE_AUTH_AGENT` attribute is used to avoid settings migration
    rootElement.setAttribute(USE_AUTH_AGENT, Boolean.toString(myAuthType == AuthType.OPEN_SSH));

    var memoryOnly = myAuthType == AuthType.KEY_PAIR && !isStorePassphrase() ||
                     myAuthType == AuthType.PASSWORD && !isStorePassword() ||
                     myAuthType == AuthType.OPEN_SSH;
    var password = switch (myAuthType) {
      case KEY_PAIR -> getPassphrase();
      case PASSWORD -> getPassword();
      default -> null;
    };
    PasswordSafe.getInstance().set(createAttributes(memoryOnly), new Credentials(getUserName(), password));

    // getConnectionConfigPatch() is omitted intentionally.
    // It's expected that the options will be set with SSH settings by one of `copyTo` calls.
  }
public void save(Element rootElement)