private static boolean moveCaretToFirstEmptyCell(@NotNull Editor editor, PsiElement element) {
    if (element instanceof XmlTag && (TD.equals(StringUtil.toLowerCase(((XmlTag)element).getName())) || TH.equals(
      StringUtil.toLowerCase(((XmlTag)element).getName())))) {
      if ("<td></td>".equals(element.getText()) || "<th></th>".equals(element.getText())) {
        PsiElement closingToken = element.getChildren()[3]; // "</" position
        moveCaretTo(editor, closingToken);
        return true;
      }
    }
    for (PsiElement child : element.getChildren()) {
      if(moveCaretToFirstEmptyCell(editor, child)) {
        return true;
      }
    }
    return false;
  }
private static boolean moveCaretToFirstEmptyCell(@NotNull Editor editor, PsiElement element)