boolean (@NotNull UsageView usageView) { UsageTarget[] targets = ((UsageViewImpl)usageView).getTargets(); if (targets.length == 0) return false; UsageTarget target = targets[0]; if (!(target instanceof PsiElementUsageTarget)) return false; PsiElement element = ((PsiElementUsageTarget)target).getElement(); if (element == null || !element.isValid()) return false; Project project = element.getProject(); DataContext context = SimpleDataContext.builder() .add(CommonDataKeys.PROJECT, project) .add(CommonDataKeys.PSI_ELEMENT, element) .build(); HierarchyProvider provider = BrowseHierarchyActionBase.findBestHierarchyProvider(LanguageCallHierarchy.INSTANCE, element, context); if (provider == null) return false; PsiElement providerTarget = provider.getTarget(context); return providerTarget != null; }