Java Code Examples for com.intellij.ide.fileTemplates.FileTemplate#getName()

The following examples show how to use com.intellij.ide.fileTemplates.FileTemplate#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CreateClassAction.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder.setTitle(IdeBundle.message("action.create.new.class"));
  for (FileTemplate fileTemplate : HaxeFileTemplateUtil.getApplicableTemplates()) {
    final String templateName = fileTemplate.getName();
    final String shortName = HaxeFileTemplateUtil.getTemplateShortName(templateName);
    final Icon icon = HaxeFileTemplateUtil.getTemplateIcon(templateName);
    builder.addKind(shortName, icon, templateName);
  }
}
 
Example 2
Source File: CreateNMMLFileAction.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@Override
protected void buildDialog(Project project, PsiDirectory directory, CreateFileFromTemplateDialog.Builder builder) {
  builder.setTitle(HaxeBundle.message("create.nmml.file.action"));
  for (FileTemplate fileTemplate : HaxeFileTemplateUtil.getNMMLTemplates()) {
    final String templateName = fileTemplate.getName();
    final String shortName = HaxeFileTemplateUtil.getTemplateShortName(templateName);
    builder.addKind(shortName, icons.HaxeIcons.Nmml_16, templateName);
  }
}
 
Example 3
Source File: FileReferenceQuickFixProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
private FileTemplate findTemplate(FileTemplateManager fileTemplateManager) {
  FileTemplate template = fileTemplateManager.getTemplate(myNewFileTemplateName);
  if (template == null) template = fileTemplateManager.findInternalTemplate(myNewFileTemplateName);
  if (template == null) {
    for (FileTemplate fileTemplate : fileTemplateManager.getAllJ2eeTemplates()) {
      final String fileTemplateWithExtension = fileTemplate.getName() + '.' + fileTemplate.getExtension();
      if (fileTemplateWithExtension.equals(myNewFileTemplateName)) {
        return fileTemplate;
      }
    }
  }
  return template;
}
 
Example 4
Source File: FileTemplateTabAsTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void selectTemplate(FileTemplate template) {
  String name = template.getName();
  if (template.getExtension().length() > 0) {
    name += "." + template.getExtension();
  }

  final FileTemplateNode node = (FileTemplateNode)TreeUtil.findNodeWithObject(myRoot, name);
  if (node != null) {
    TreeUtil.selectNode(myTree, node);
    onTemplateSelected(); // this is important because we select different Template for the same node
  }
}
 
Example 5
Source File: CreateFromTemplateAction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public CreateFromTemplateAction(FileTemplate template){
  super(template.getName(), null, FileTemplateUtil.getIcon(template));
  myTemplate = template;
}
 
Example 6
Source File: FileTemplateManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public String localizeInternalTemplateName(@Nonnull final FileTemplate template) {
  return template.getName();
}