protected void installTreeListener(final @NotNull JTree tree) {
    tree.addTreeSelectionListener(new TreeSelectionListener() {
      @Override
      public void valueChanged(final TreeSelectionEvent e) {
        if (!shouldUpdateHint()) return;

        TreePath path = tree.getSelectionPath();
        if (path != null) {
          final PsiElement psiElement = getPsiElementForHint(path.getLastPathComponent());
          if (psiElement != null && psiElement.isValid()) {
            updateHint(psiElement);
          }
        }
      }
    });
  }
protected void installTreeListener(final @NotNull JTree tree)