void (@NotNull FileSystemTree fileSystemTree, @NotNull AnActionEvent e) { FileType fileType = e.getData(FileChooserKeys.NEW_FILE_TYPE); String initialContent = e.getData(FileChooserKeys.NEW_FILE_TEMPLATE_TEXT); if (fileType == null || initialContent == null) return; VirtualFile file = fileSystemTree.getNewFileParent(); if (file == null || !file.isDirectory()) return; String name; while (true) { name = Messages.showInputDialog(UIBundle.message("create.new.file.enter.new.file.name.prompt.text"), UIBundle.message("new.file.dialog.title"), Messages.getQuestionIcon()); if (name == null) { return; } name = name.strip(); if (name.isEmpty()) { Messages.showMessageDialog(UIBundle.message("create.new.file.file.name.cannot.be.empty.error.message"), UIBundle.message("error.dialog.title"), Messages.getErrorIcon()); continue; } Exception failReason = ((FileSystemTreeImpl)fileSystemTree).createNewFile(file, name, fileType, initialContent); if (failReason != null) { Messages.showMessageDialog(UIBundle.message("create.new.file.could.not.create.file.error.message", name), UIBundle.message("error.dialog.title"), Messages.getErrorIcon()); continue; } return; } }