private @NotNull String tryHighlightLinkLabel(@NotNull PsiElement element, @NotNull String label) {
    if (element instanceof PsiClass) {
      return getStyledSpan(true, tuneAttributesForLink(getHighlightingManager().getClassDeclarationAttributes((PsiClass)element)), label);
    }
    if (element instanceof PsiPackage) {
      return getStyledSpan(true, tuneAttributesForLink(getHighlightingManager().getClassNameAttributes()), label);
    }
    else if (element instanceof PsiMethod) {
      return tryHighlightLinkOnClassMember(
        (PsiMember)element, tuneAttributesForLink(getHighlightingManager().getMethodDeclarationAttributes((PsiMethod)element)), label);
    }
    else if (element instanceof PsiField) {
      return tryHighlightLinkOnClassMember(
        (PsiField)element, tuneAttributesForLink(getHighlightingManager().getFieldDeclarationAttributes((PsiField)element)), label);
    }
    else {
      return getHighlightedByLexerAndEncodedAsHtmlCodeSnippet(element.getProject(), element.getLanguage(), label);
    }
  }
private @NotNull String tryHighlightLinkLabel(@NotNull PsiElement element, @NotNull String label)