void (final MouseEvent e, final T elt) { final List<NavigatablePsiElement> navElements = new ArrayList<>(); final Query<? extends PsiElement> elementQuery = search(elt, TypeEvalContext.userInitiated(elt.getProject(), elt.getContainingFile())); if (elementQuery == null) { return; } elementQuery.forEach(psiElement -> { if (psiElement instanceof NavigatablePsiElement) { navElements.add((NavigatablePsiElement)psiElement); } return true; }); /* * For test purposes, we should be able to access list of methods to check em. * {@link PsiElementListNavigator} simply opens then (hence it is swing-based) and can't be used in tests. * So, in unit tests we save data in element and data could be obtained with {@link #getNavigationTargets(UserDataHolder)} */ final NavigatablePsiElement[] methods = navElements.toArray(NavigatablePsiElement.EMPTY_NAVIGATABLE_ELEMENT_ARRAY); if (ApplicationManager.getApplication().isUnitTestMode()) { elt.putUserData(MARKERS, methods); } else { PsiElementListNavigator.openTargets(e, methods, getTitle(elt), null, new DefaultPsiElementCellRenderer()); } }