Pre-fill file name in CreateFileFromTemplateAction dialog



I have following simple code

public class CreateOMIFileFromTemplateAction extends CreateFileFromTemplateAction {

private static final String ENTITY_TEMPLATE = "Entity";

public CreateOMIFileFromTemplateAction() {
super("OMI", "Create new OMI file", null);

protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
builder.setTitle("New OMI file");
builder.addKind("Entity ", null, ENTITY_TEMPLATE);

protected String getActionName(PsiDirectory directory, String name, String template) {
return "Creating new OMI file";

protected PsiFile createFile(String name, String templateName, PsiDirectory dir) {
final FileTemplate template = FileTemplateManager.getInstance(dir.getProject()).getInternalTemplate(templateName);
return createFileFromTemplate(name, template, dir);

and I would like to pre-fill file name (myNameLabel) according to folder structure in project. For example "com.BPE.customer." if dialog is invoked from "bpe, customer" (com is default extension). Can be myNameLabel from dialog set up?

Thank you.


1 comment
Comment actions Permalink

What a nonsense, please ignore that...I can not see delete at least on mobile.


Please sign in to leave a comment.