problems whit file template

Hi

I have a problem whit the file template mecanism;

I have an ApplicationComponent that implementes FileTemplateGroupDescriptorFactory,


the method:

public FileTemplateGroupDescriptor getFileTemplatesDescriptor()
{
FileTemplateGroupDescriptor descriptor = new FileTemplateGroupDescriptor("Stripes
Templates", StripesConstants.STRIPES_ICON);
descriptor.addTemplate(LOG4J_PROPERTIES);
descriptor.addTemplate(COMMONS_LOGGING_PROPERTIES);
descriptor.addTemplate(STRIPES_RESOURCES_PROPERTIES);
return descriptor;
}

and I add the files *.ft in the jar in the directory fileTemplates/j2ee

Intellij IDEA Already detect the and create the "Stripes Templates" group
and add the 3 templates but the templates Body is empty :(

and when I try to create the fiel from the template whit this code

if (resources)
{
stripesTemplate = FileTemplateManager.getInstance().getJ2eeTemplate(StripesApplicationComponent.STRIPES_RESOURCES_PROPERTIES);
FileTemplateUtil.createFromTemplate(stripesTemplate, "StripesResources.properties",
null, project, directory);
}

Intellij throw this exception

Unable to find J2EE Template 'StripesResources.properties'!
Default J2EE Templates are:
C:\Archivos de programa\JetBrains\IntelliJ IDEA 6.0\plugins\GWTStudio\lib\resources_en.jar!\fileTemplates\j2ee\GwtAppCss.css.ft,

C:\Archivos de programa\JetBrains\IntelliJ IDEA 6.0\plugins\Glassfish\lib\glassfishIntegration.jar!\fileTemplates\j2ee\sun-web_2_5-0.xml.ft,

C:\Archivos de programa\JetBrains\IntelliJ IDEA 6.0\lib\resources_en.jar!\fileTemplates\j2ee\application.1_3.xml.ft,

C:\Archivos de programa\JetBrains\IntelliJ IDEA 6.0\plugins\JBoss\lib\jbossIntegration.jar!\fileTemplates\j2ee\jboss-web_3_2.xml.ft,
.........
...
...
...
...
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
at com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl.a(FileTemplateManagerImpl.java:179)
at com.intellij.ide.fileTemplates.impl.FileTemplateManagerImpl.getJ2eeTemplate(FileTemplateManagerImpl.java:78)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.doInstallStripes(StripesAddSupportContext.java:105)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.installSupport(StripesAddSupportContext.java:69)
at com.intellij.ide.util.projectWizard.AddSupportContext$1.run(AddSupportContext.java:73)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:145)
at com.intellij.openapi.application.RunResult.run(RunResult.java:27)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:101)
at com.intellij.openapi.application.impl.ApplicationImpl$9.compute(ApplicationImpl.java)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:100)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:377)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:99)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:22)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:97)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:75)
at com.intellij.ide.util.projectWizard.AddSupportContext.installSupportInAction(AddSupportContext.java:70)
at com.intellij.ide.util.projectWizard.ModuleBuilder.addSupport(ModuleBuilder.java:131)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1$1.run(ModuleBuilder.java:113)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:402)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1.run(ModuleBuilder.java:111)
at com.intellij.ide.startup.impl.StartupManagerImpl.a(StartupManagerImpl.java:30)
at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.java:53)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:130)
at com.intellij.ide.impl.ProjectUtil.createNewProject(ProjectUtil.java:0)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$4.onPress(WelcomeScreen.java)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$ActionGroupDescriptor$2.mouseClicked(WelcomeScreen.java)
at java.awt.Component.processMouseEvent(Component.java:5504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5266)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3968)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:8)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:42)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:73)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



java.lang.RuntimeException: java.lang.IllegalArgumentException: template
cannot be null
at com.intellij.stripes.wizards.support.StripesAddSupportContext.installSupport(StripesAddSupportContext.java:73)
at com.intellij.ide.util.projectWizard.AddSupportContext$1.run(AddSupportContext.java:73)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:145)
at com.intellij.openapi.application.RunResult.run(RunResult.java:27)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:101)
at com.intellij.openapi.application.impl.ApplicationImpl$9.compute(ApplicationImpl.java)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:100)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:377)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:99)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:22)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:97)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:75)
at com.intellij.ide.util.projectWizard.AddSupportContext.installSupportInAction(AddSupportContext.java:70)
at com.intellij.ide.util.projectWizard.ModuleBuilder.addSupport(ModuleBuilder.java:131)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1$1.run(ModuleBuilder.java:113)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:402)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1.run(ModuleBuilder.java:111)
at com.intellij.ide.startup.impl.StartupManagerImpl.a(StartupManagerImpl.java:30)
at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.java:53)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:130)
at com.intellij.ide.impl.ProjectUtil.createNewProject(ProjectUtil.java:0)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$4.onPress(WelcomeScreen.java)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$ActionGroupDescriptor$2.mouseClicked(WelcomeScreen.java)
at java.awt.Component.processMouseEvent(Component.java:5504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5266)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3968)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:8)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:42)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:73)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Caused by: java.lang.IllegalArgumentException: template cannot be null
at com.intellij.ide.fileTemplates.FileTemplateUtil.createFromTemplate(FileTemplateUtil.java:62)
at com.intellij.ide.fileTemplates.FileTemplateUtil.createFromTemplate(FileTemplateUtil.java:129)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.doInstallStripes(StripesAddSupportContext.java:106)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.installSupport(StripesAddSupportContext.java:69)
... 44 more



java.lang.IllegalArgumentException: template cannot be null
at com.intellij.ide.fileTemplates.FileTemplateUtil.createFromTemplate(FileTemplateUtil.java:62)
at com.intellij.ide.fileTemplates.FileTemplateUtil.createFromTemplate(FileTemplateUtil.java:129)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.doInstallStripes(StripesAddSupportContext.java:106)
at com.intellij.stripes.wizards.support.StripesAddSupportContext.installSupport(StripesAddSupportContext.java:69)
at com.intellij.ide.util.projectWizard.AddSupportContext$1.run(AddSupportContext.java:73)
at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:145)
at com.intellij.openapi.application.RunResult.run(RunResult.java:27)
at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:101)
at com.intellij.openapi.application.impl.ApplicationImpl$9.compute(ApplicationImpl.java)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.postponeFormattingInside(PostprocessReformattingAspect.java:100)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:377)
at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:99)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:22)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:97)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:75)
at com.intellij.ide.util.projectWizard.AddSupportContext.installSupportInAction(AddSupportContext.java:70)
at com.intellij.ide.util.projectWizard.ModuleBuilder.addSupport(ModuleBuilder.java:131)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1$1.run(ModuleBuilder.java:113)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:402)
at com.intellij.ide.util.projectWizard.ModuleBuilder$1.run(ModuleBuilder.java:111)
at com.intellij.ide.startup.impl.StartupManagerImpl.a(StartupManagerImpl.java:30)
at com.intellij.ide.startup.impl.StartupManagerImpl.runPostStartupActivities(StartupManagerImpl.java:53)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:130)
at com.intellij.ide.impl.ProjectUtil.createNewProject(ProjectUtil.java:0)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$4.onPress(WelcomeScreen.java)
at com.intellij.openapi.wm.impl.welcomeScreen.WelcomeScreen$ActionGroupDescriptor$2.mouseClicked(WelcomeScreen.java)
at java.awt.Component.processMouseEvent(Component.java:5504)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)
at java.awt.Component.processEvent(Component.java:5266)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3968)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3901)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1778)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:8)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:42)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:73)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


what is the problem?????




1 comment
Comment actions Permalink

Are your template content files name exactly like the .ft file but without the .ft extension ?

Does the template description that you provide you the .ft file show up in the template manager gui ?

0

Please sign in to leave a comment.