idea-plugin / arrow.meta.ide.dsl.ui.dialogs / DialogSyntax / addFileAction

addFileAction

open fun IdeMetaPlugin.addFileAction(actionId: String, createText: String, actionDescription: String, buildDialog: Builder.(project: Project, directory: PsiDirectory) -> Unit = Noop.effect3, postProcess: (createdElement: PsiFile, templateName: String, customProperties: MutableMap<String, String>) -> Unit = Noop.effect3, fileIcon: Icon? = KotlinFileType.INSTANCE.icon, actionName: (directory: PsiDirectory, newName: String, templateName: String) -> String = { _, _, _ -> createText }, createFileFromTemplate: (name: String, template: FileTemplate, dir: PsiDirectory) -> PsiFile? = { name, template, dir -> NewKotlinFileAction.createFileFromTemplateWithStat(name, template, dir) }, startInWriteAction: Boolean = false): ExtensionPhase

import arrow.meta.ide.IdePlugin
import arrow.meta.ide.IdeMetaPlugin
import arrow.meta.ide.invoke
import org.jetbrains.kotlin.idea.KotlinFileType

val IdeMetaPlugin.createFilePlugin: IdePlugin
 get() = "Create File Dialog" {
  meta(
    addFileAction("ExampleAction", "New File", "Creates a new File",
      buildDialog = { project, directory ->
        setTitle("MyTitle")
        addKind("File", KotlinFileType.INSTANCE.icon, "Kotlin File")
      }
     )
    )
  }

Parameters

actionId - has to be unique

Do you like Arrow?

Arrow Org
<