boolean (final Project project, @NotNull final PsiElement psiElement, PsiLanguageInjectionHost host, final String languageId) { final PsiElement target = ContextComputationProcessor.getTopLevelInjectionTarget(psiElement); final PsiElement parent = target.getParent(); if (parent instanceof PsiReturnStatement || parent instanceof PsiMethod || parent instanceof PsiNameValuePair) { return doInjectInJavaMethod(project, findPsiMethod(parent), -1, host, languageId); } else if (parent instanceof PsiExpressionList && parent.getParent() instanceof PsiCall) { return doInjectInJavaMethod(project, findPsiMethod(parent), findParameterIndex(target, (PsiExpressionList)parent), host, languageId); } else if (parent instanceof PsiAssignmentExpression) { final PsiExpression psiExpression = ((PsiAssignmentExpression)parent).getLExpression(); if (psiExpression instanceof PsiReferenceExpression) { final PsiElement element = ((PsiReferenceExpression)psiExpression).resolve(); if (element != null) { return doInjectInJava(project, element, host, languageId); } } } else if (parent instanceof PsiVariable) { return doAddLanguageAnnotation(project, (PsiModifierListOwner)parent, host, languageId); } else if (target instanceof PsiVariable) { return doAddLanguageAnnotation(project, (PsiModifierListOwner)target, host, languageId); } return false; }