@Nullable
  public static ASTNode getReferenceNameElement(@Nullable ASTNode element) {
    if (element == null) {
      return null;
    }
    IElementType type = element.getElementType();
    if (is(type, BASIC_IMPORT_STATIC_REFERENCE)) {
      return findChildByType(element, JavaTokenType.IDENTIFIER);
    }
    else if (is(type, BASIC_JAVA_CODE_REFERENCE)) {
      return TreeUtil.findChildBackward(element, JavaTokenType.IDENTIFIER);
    }
    else if (is(type, BASIC_METHOD_REF_EXPRESSION)) {
      final ASTNode lastChild = element.getLastChildNode();
      return is(lastChild, JavaTokenType.IDENTIFIER) || is(lastChild, JavaTokenType.NEW_KEYWORD) ? lastChild : null;
    }
    else if (is(type, BASIC_REFERENCE_EXPRESSION)) {
      ASTNode lastChild = element.getLastChildNode();
      return lastChild == null || is(lastChild,
                                     ContainerUtil.newHashSet(JavaTokenType.IDENTIFIER, JavaTokenType.THIS_KEYWORD,
                                                              JavaTokenType.SUPER_KEYWORD)) ?
             lastChild : findChildByType(element, JavaTokenType.IDENTIFIER);
    }
    return null;
  }
@Nullable
  public static ASTNode getReferenceNameElement(@Nullable ASTNode element)