private static @Nullable String guessTagLocation(DomElement element) {
    String location = toShortName(firstNotNullAttribute(
      element, "instance", "class", "implementation", "implementationClass", "interface", "interfaceClass"));

    // avoid displaying location equal to display text for actions
    if (location == null && !(element instanceof Action)) {
      location = firstNotNullAttribute(element, "id", "name", "displayName", "shortName");
    }
    if (location == null) {
      location = firstNotNullAttribute(element, "file");
    }

    if (location != null) {
      return location;
    }

    DomGenericInfo genericInfo = element.getGenericInfo();
    List<? extends DomAttributeChildDescription<?>> attrDescriptions = genericInfo.getAttributeChildrenDescriptions();
    String possibleOnlyAttrValue = null;
    for (DomAttributeChildDescription<?> description : attrDescriptions) {
      String value = description.getDomAttributeValue(element).getStringValue();
      if (StringUtil.isEmpty(value)) {
        continue;
      }
      if (possibleOnlyAttrValue == null) {
        possibleOnlyAttrValue = value;
      }
      else {
        // more than one attribute
        possibleOnlyAttrValue = null;
        break;
      }
    }

    if (possibleOnlyAttrValue != null && StringUtil.countChars(possibleOnlyAttrValue, '.') > 2) {
      possibleOnlyAttrValue = toShortName(possibleOnlyAttrValue);
    }

    if (possibleOnlyAttrValue != null) {
      return possibleOnlyAttrValue;
    }

    // check if tag doesn't have attributes and subtags and use its text content as a location in such cases
    if (attrDescriptions.isEmpty() && genericInfo.getFixedChildrenDescriptions().isEmpty()) {
      if (element instanceof GenericDomValue) {
        return ((GenericDomValue<?>)element).getRawText();
      }
    }

    return null;
  }
private static @Nullable String guessTagLocation(DomElement element)