SourcePosition (String name, @NotNull Project project, @NotNull DebuggerContextImpl context, boolean nearest) { PsiElement place = PositionUtil.getContextElement(context); if (place == null) return null; PsiVariable psiVariable = JavaPsiFacade.getInstance(project).getResolveHelper().resolveReferencedVariable(name, place); if (psiVariable == null) return null; PsiFile containingFile = psiVariable.getContainingFile(); if (containingFile == null) return null; try { if (nearest) { return DebuggerContextUtil.findNearest(context, psiVariable, containingFile); } } catch (IndexNotReadyException ignore) { } return SourcePosition.createFromElement(psiVariable); }