diff --git a/src/main/kotlin/de/idetools/filename_template/CreateFileWithFilenameTemplateAction.kt b/src/main/kotlin/de/idetools/filename_template/CreateFileWithFilenameTemplateAction.kt index 7d65193..f3956c0 100644 --- a/src/main/kotlin/de/idetools/filename_template/CreateFileWithFilenameTemplateAction.kt +++ b/src/main/kotlin/de/idetools/filename_template/CreateFileWithFilenameTemplateAction.kt @@ -5,6 +5,7 @@ import com.intellij.ide.IdeBundle import com.intellij.ide.actions.CreateFileAction import com.intellij.ide.ui.newItemPopup.NewItemPopupUtil import com.intellij.lang.LangBundle +import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project import com.intellij.openapi.ui.InputValidatorEx import com.intellij.openapi.util.Trinity @@ -29,6 +30,14 @@ class CreateFileWithFilenameTemplateAction : DefaultPlaceholder() ) + override fun update(e: AnActionEvent) { + if (FilenameTemplateSettingsState.instance.filenameTemplates.isEmpty()) { + e.presentation.isEnabledAndVisible = false + } else { + super.update(e) + } + } + override fun invokeDialog( project: Project, directory: PsiDirectory,