@PopupTitle
  private static String getTitle(@PopupTitle @NotNull String titlePattern, Collection<PsiElement> elements, PsiReference reference) {
    if (reference == null) {
      return titlePattern;
    }
    final TextRange range = reference.getRangeInElement();
    final String elementText = reference.getElement().getText();
    LOG.assertTrue(range.getStartOffset() >= 0 && range.getEndOffset() <= elementText.length(),
                   elements.toString() + ";" + reference);
    final String refText = range.substring(elementText);
    return MessageFormat.format(titlePattern, refText);
  }
@PopupTitle
  private static String getTitle(@PopupTitle @NotNull String titlePattern, Collection<PsiElement> elements, PsiReference reference)