@NotNull
  protected final PsiElement[] invokeDialog(final Project project, final PsiDirectory directory) {
    log.debug("invokeDialog");
    final MyInputValidator validator = new MyInputValidator(project, directory);
    Messages.showInputDialog(
        project, getDialogPrompt(), getDialogTitle(), Messages.getQuestionIcon(), "", validator);

    final PsiElement[] elements = validator.getCreatedElements();
    log.debug("Result: " + Arrays.toString(elements));
    return elements;
  }