Pre-fill file name in CreateFileFromTemplateAction dialog

已完成

Hi,

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);
}

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

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

@Override
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.

 

0

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

0

请先登录再写评论。