private static @Nullable String getTextBlockFragmentContent(PsiFragment fragment) {
    final IElementType tokenType = fragment.getTokenType();
    final String text = fragment.getText();
    String content;
    if (tokenType == JavaTokenType.TEXT_BLOCK_TEMPLATE_BEGIN) {
      if (!(text.startsWith("\"\"\""))) {
        return null;
      }
      int start = 3;
      while (true) {
        char c = text.charAt(start++);
        if (c == '\n') {
          break;
        }
        if (!PsiLiteralUtil.isTextBlockWhiteSpace(c) || start == text.length()) {
          return null;
        }
      }
      content = text.substring(start, text.length() - 2);
    }
    else if (tokenType == JavaTokenType.TEXT_BLOCK_TEMPLATE_MID) {
      content = text.substring(1, text.length() - 2);
    }
    else if (tokenType == JavaTokenType.TEXT_BLOCK_TEMPLATE_END) {
      if (!(text.endsWith("\"\"\""))) return null;
      content = text.substring(1, text.length() - 3);
    }
    else {
      return null;
    }

    int indent = getTextBlockFragmentIndent(fragment);
    return (indent < 0) ? null : stripTextBlockIndent(tokenType, content, indent);
  }
private static @Nullable String getTextBlockFragmentContent(PsiFragment fragment)