private ActionCallback typeCodes(final PlaybackContext context, final Robot robot, final String codes) {
    final ActionCallback result = new ActionCallback();

    Runnable runnable = () -> {
      String[] pairs = codes.split(CODE_DELIMITER);
      for (String eachPair : pairs) {
        try {
          String[] splits = eachPair.split(MODIFIER_DELIMITER);
          int code = Integer.parseInt(splits[0]);
          int modifier = Integer.parseInt(splits[1]);
          //noinspection MagicConstant
          type(robot, code, modifier);
        }
        catch (NumberFormatException e) {
          dumpError(context, "Invalid code: `" + eachPair + "`. " + e.getMessage());
          result.setRejected();
          return;
        }
      }

      result.setDone();
    };


    if (SwingUtilities.isEventDispatchThread()) {
      ApplicationManager.getApplication().executeOnPooledThread(runnable);
    } else {
      runnable.run();
    }

    return result;
  }
private ActionCallback typeCodes(final PlaybackContext context, final Robot robot, final String codes)