How to use PsiDirectory.createClass(String name, String templateName)?
Trying to create a class from a custom template but *PsiDirectorycreateClass(newName, "foobar") *always fails with "Cannot create foobar - incorrect foobar template". As a test I have created a usable foobar template, which can be accessed via the standard "New->foobar" command. Apparently I'm getting the templateName parameter wrong?
Please sign in to leave a comment.
This error is indeed caused by incorrect template. Can you post the template text here?
This error is indeed caused by incorrect template. Can you post the template text here?
I have copied the standard class template for this test. I can run it manually and it works correctly. But I get the error if I try to run the same template via the Open API.
Do you set all variables mentioned in template text? If not the text is lekely to be nonparsable.
Oh, now I see, this method is not interactive. How can I programmatically launch the "create class from template" function? Also, is it possible to place the template in a location that's not visible to the user?