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; if (!(element instanceof PsiVariable)) return false; PsiFile file = element.getContainingFile(); return file instanceof PsiJavaFile; }