Using FreeMarker extension points
Hi,
I'm writing a plugin which needs to contribute implicit variables to FreeMarker templates. I've found the 'FtlGlobalVariableProvider' class which can be extended and registered under the 'freemarker.globalVariableProvider' extension point.
But I'm not sure how to create the FtlXXX variables. I've tried this:
@NotNull
@Override
public List<? extends FtlVariable> getGlobalVariables( FtlFile ftlFile )
{
FtlImplicitVariable languages = new FtlImplicitVariable( null, "languages", ftlFile );
languages.addSubVariable( "en" );
return Arrays.asList( languages );
}
This code throws an NPE because I'm passing 'null' as the PsiComment parameter to FtlImplicitVariable - how do I create a PsiComment?
Please sign in to leave a comment.
see https://github.com/JetBrains/intellij-plugins/blob/master/struts2/plugin/src/com/intellij/struts2/freemarker/Struts2GlobalVariableProvider.java as example
10x! exactly what I've been looking for.