public abstract class CreateFromTemplateHandler
extends org.netbeans.api.templates.CreateFromTemplateHandler
CreateFromTemplateHandler
instead.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 | Description |
---|---|---|
static String |
FREE_FILE_EXTENSION |
Deprecated.
Parameter to enable free file extension mode.
|
Constructor | Description |
---|---|
CreateFromTemplateHandler() |
Deprecated.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
accept(org.netbeans.api.templates.CreateDescriptor desc) |
Deprecated.
|
protected abstract boolean |
accept(org.openide.filesystems.FileObject orig) |
Deprecated.
Method that allows a handler to reject a file.
|
protected List<org.openide.filesystems.FileObject> |
createFromTemplate(org.netbeans.api.templates.CreateDescriptor desc) |
Deprecated.
|
protected abstract org.openide.filesystems.FileObject |
createFromTemplate(org.openide.filesystems.FileObject orig,
org.openide.filesystems.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(org.netbeans.api.templates.CreateDescriptor desc)
accept
in class org.netbeans.api.templates.CreateFromTemplateHandler
protected List<org.openide.filesystems.FileObject> createFromTemplate(org.netbeans.api.templates.CreateDescriptor desc) throws IOException
createFromTemplate
in class org.netbeans.api.templates.CreateFromTemplateHandler
IOException
protected abstract boolean accept(org.openide.filesystems.FileObject orig)
DataObject.handleCreateFromTemplate(org.openide.loaders.DataFolder, java.lang.String)
is going to take place.orig
- the file of the templateprotected abstract org.openide.filesystems.FileObject createFromTemplate(org.openide.filesystems.FileObject orig, org.openide.filesystems.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/OBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.