@Override
  public Result calculateResult(ExpressionContext context) {
    final Project project = context.getProject();
    Editor editor = context.getEditor();
    if (editor != null) {
      Document document = editor.getDocument();
      PsiDocumentManager.getInstance(project).commitDocument(document);
    }
    if (myItems.isEmpty()) return null;

    final PsiType type = myItems.iterator().next().getType();
    return type == null ? null : new PsiTypeResult(type, project) {
      @Override
      public void handleRecalc(PsiFile psiFile, Document document, int segmentStart, int segmentEnd) {
        if (myItems.size() <= 1) {
          super.handleRecalc(psiFile, document, segmentStart, segmentEnd);
        }
        else {
          JavaTemplateUtil.updateTypeBindings(getType(), psiFile, document, segmentStart, segmentEnd, true);
        }
      }
    };
  }
@Override
  public Result calculateResult(ExpressionContext context)