public static @Nullable XmlComment findPreviousComment(final PsiElement element) {
    PsiElement curElement = element;

    while (curElement != null && !(curElement instanceof XmlComment)) {
      curElement = curElement.getPrevSibling();
      if (curElement instanceof XmlText && StringUtil.isEmptyOrSpaces(curElement.getText())) {
        continue;
      }
      if (!(curElement instanceof PsiWhiteSpace) &&
          !(curElement instanceof XmlProlog) &&
          !(curElement instanceof XmlComment)
      ) {
        curElement = null; // finding comment fails, we found another similar declaration
        break;
      }
    }
    return (XmlComment)curElement;
  }
public static @Nullable XmlComment findPreviousComment(final PsiElement element)