Disable action when no template is configured
This commit is contained in:
parent
eb94b71723
commit
525b76b208
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user