PsiSubstitutor (PsiElement originalElement) { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; if (originalElement instanceof PsiReferenceExpression) { LOG.assertTrue(originalElement.isValid()); substitutor = ((PsiReferenceExpression)originalElement).advancedResolve(true).getSubstitutor(); } return substitutor; }