@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
    final TemplateImpl template = getTemplate();
    SelectionModel selectionModel = editor.getSelectionModel();
    if (!selectionModel.hasSelection()) {
      final PsiExpression iterableExpression = getIterableExpression(editor, file);
      Logger.getInstance(IterateOverIterableIntention.class).assertTrue(iterableExpression != null);

      PsiElement element = PsiTreeUtil.skipSiblingsForward(iterableExpression, PsiWhiteSpace.class, PsiComment.class);
      if (PsiUtil.isJavaToken(element, JavaTokenType.SEMICOLON)) {
        element.delete();
        PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(file.getViewProvider().getDocument());
      }
      TextRange textRange = iterableExpression.getTextRange();
      selectionModel.setSelection(textRange.getStartOffset(), textRange.getEndOffset());
    }
    new InvokeTemplateAction(template, editor, project, new HashSet<>()).performInCommand();
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file)