private static Template buildTemplate(final @NotNull XmlTag tag, final @NotNull Pair<? extends ASTNode, ? extends ASTNode> pair) {
    final TemplateBuilderImpl builder = new TemplateBuilderImpl(tag);

    final ASTNode selected = pair.first;
    final ASTNode other = pair.second;

    builder.replaceElement(selected.getPsi(), PRIMARY_VARIABLE_NAME, new ConstantNode(selected.getText()), true);

    if (other != null) {
      builder.replaceElement(other.getPsi(), OTHER_VARIABLE_NAME, PRIMARY_VARIABLE_NAME, false);
    }

    return builder.buildInlineTemplate();
  }
private static Template buildTemplate(final @NotNull XmlTag tag, final @NotNull Pair<? extends ASTNode, ? extends ASTNode> pair)