protected void apply(@NotNull Project project,
                       @NotNull Supplier<? extends @Nullable PsiDirectory> targetDirectory,
                       @Nullable Editor editor)
    throws IncorrectOperationException {

    // only for compatibility with 3-rd party plugins, not used
    @Nullable PsiDirectory directory;
    try {
      directory = WriteCommandAction.writeCommandAction(project)
        .withName(CodeInsightBundle.message(myKey, myNewFileName))
        .compute(() -> targetDirectory.get());
    }
    catch (IncorrectCreateFilePathException e) {
      if (editor != null) {
        HintManager.getInstance().showErrorHint(editor, e.getLocalizedMessage());
      }
      directory = null;
    }
    if (directory != null) {
      // for compatibility with plugins
      apply(project, directory, editor);
    }
  }
protected void apply(@NotNull Project project,
                       @NotNull Supplier<? extends @Nullable PsiDirectory> targetDirectory,
                       @Nullable Editor editor)