@Override
      public void valueChanged(final ListSelectionEvent e) {
        if (!shouldUpdateHint()) return;

        int selected = ((ListSelectionModel)e.getSource()).getLeadSelectionIndex();
        int rowCount = table.getRowCount();
        if (selected == -1 || rowCount == 0) return;

        PsiElement element = getPsiElementForHint(table.getValueAt(Math.min(selected, rowCount - 1), 0));
        if (element != null && element.isValid()) {
          updateHint(element);
        }
      }
@Override
      public void valueChanged(final ListSelectionEvent e)