void (@NotNull Project project, ItemWithPresentation element, Consumer<Navigatable> navigator) { Navigatable nav; if (element.getItem() instanceof Navigatable) { nav = (Navigatable)element.getItem(); } else { nav = ActionUtil.underModalProgress(project, IdeBundle.message("progress.title.preparing.navigation"), () -> { PsiElement psiElement = ((SmartPsiElementPointer<?>)element.getItem()).getElement(); return psiElement == null ? null : EditSourceUtil.getDescriptor(psiElement); }); } try { if (nav != null && nav.canNavigate()) { navigator.accept(nav); } } catch (IndexNotReadyException e) { DumbService.getInstance(project).showDumbModeNotificationForFunctionality( CodeInsightBundle.message("notification.navigation.is.not.available.while.indexing"), DumbModeBlockedFunctionality.GotoTarget); } }