private boolean selectTargetElement(int keyCode) {
    if (!isPopupActive()) return false;
    Iterator<T> it;
    if (keyCode == KeyEvent.VK_UP) {
      it = iterate(getSelection(), false, TreeUtil.isCyclicScrollingAllowed());
    }
    else if (keyCode == KeyEvent.VK_DOWN) {
      it = iterate(getSelection(), true, TreeUtil.isCyclicScrollingAllowed());
    }
    else if (keyCode == KeyEvent.VK_HOME) {
      it = iterate(null, true);
    }
    else if (keyCode == KeyEvent.VK_END) {
      it = iterate(null, false);
    }
    else {
      return false;
    }
    it = filterMatchingNodes(JBIterator.from(it), false);
    if (it.hasNext()) {
      select(it.next());
    }
    return true;
  }
private boolean selectTargetElement(int keyCode)