CreateFromTemplateHandler
instead.public abstract class CreateFromTemplateHandler extends CreateFromTemplateHandler
smart templatingthat allows any module to intercept calls to
DataObject.createFromTemplate(org.openide.loaders.DataFolder)
and handle them themselves. The NetBeans IDE provides default
implementation that allows use of Freemarker templating engine.
Read more in the howto document.
This SPI is now deprecated and serves just a backward compatilibity SPI adapter
which allows the template API to work with legacy handlers. The templating SPI is delegated
to the original handler methods.Modifier and Type | Field and Description |
---|---|
static String |
FREE_FILE_EXTENSION
Deprecated.
Parameter to enable free file extension mode.
|
Constructor and Description |
---|
CreateFromTemplateHandler()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(CreateDescriptor desc)
Deprecated.
|
protected abstract boolean |
accept(FileObject orig)
Deprecated.
Method that allows a handler to reject a file.
|
protected List<FileObject> |
createFromTemplate(CreateDescriptor desc)
Deprecated.
|
protected abstract FileObject |
createFromTemplate(FileObject orig,
FileObject f,
String name,
Map<String,Object> parameters)
Deprecated.
Handles the creation of new file.
|
public static final String FREE_FILE_EXTENSION
createFromTemplate(org.netbeans.api.templates.CreateDescriptor)
is called with this
parameter set to Boolean.TRUE
(such as from DataObject.createFromTemplate(DataFolder,String,Map)
),
and the file name already seems to
include an extension (*.*), the handler should not append
any extension from the template.Templates.SimpleTargetChooserBuilder.freeFileExtension
,
Constant Field Valuespublic boolean accept(CreateDescriptor desc)
accept
in class CreateFromTemplateHandler
protected List<FileObject> createFromTemplate(CreateDescriptor desc) throws IOException
createFromTemplate
in class CreateFromTemplateHandler
IOException
protected abstract boolean accept(FileObject orig)
DataObject.handleCreateFromTemplate(org.openide.loaders.DataFolder, java.lang.String)
is going to take place.orig
- the file of the templateprotected abstract FileObject createFromTemplate(FileObject orig, FileObject f, String name, Map<String,Object> parameters) throws IOException
orig
- the source filef
- the folder to create a file inname
- the name of new file to create in the folder (see FREE_FILE_EXTENSION
regarding extension)parameters
- map of additional arguments as specified by registered CreateFromTemplateAttributesProvider
sIOException
- if something goes wrong with I/O