private static PsiMethodCallExpression prepareMethodCall(PsiReferenceExpression expr, String text) {
    PsiExpression qualifier = expr.getQualifierExpression();
    if (qualifier != null) {
      final PsiElement referenceNameElement = expr.getReferenceNameElement();
      if (referenceNameElement != null) {
        text = expr.getText().substring(0, referenceNameElement.getStartOffsetInParent()) + text;
      }
    }
    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(expr.getProject());
    return (PsiMethodCallExpression)factory.createExpressionFromText(text, expr);
  }
private static PsiMethodCallExpression prepareMethodCall(PsiReferenceExpression expr, String text)