@NonNls String... parameters )
throws IncorrectOperationException
{
// Load template
FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance();
FileTemplate template = fileTemplateManager.getJ2eeTemplate( templateName );
// Process template properties
Properties properties = new Properties( fileTemplateManager.getDefaultProperties() );
JavaTemplateUtil.setPackageNameAttribute( properties, directory );
properties.setProperty( NAME_TEMPLATE_PROPERTY, name );
// Add parameters
for( int i = 0; i < parameters.length; i += 2 )
{
properties.setProperty( parameters[ i ], parameters[ i + 1 ] );
}
// Create text from template with specified properties
String text;
try
{
text = template.getText( properties );
}
catch( Exception e )
{
String message = "Unable to load template for " +
fileTemplateManager.internalTemplateToSubject( templateName );