public abstract class CreateFromTemplateHandler extends Object
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.Modifier and Type | Field and Description |
---|---|
static String |
FREE_FILE_EXTENSION
Parameter to enable free file extension mode.
|
Constructor and Description |
---|
CreateFromTemplateHandler() |
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
accept(FileObject orig)
Method that allows a handler to reject a file.
|
protected abstract FileObject |
createFromTemplate(FileObject orig,
FileObject f,
String name,
Map<String,Object> parameters)
Handles the creation of new file.
|
public static final String FREE_FILE_EXTENSION
createFromTemplate(org.openide.filesystems.FileObject, org.openide.filesystems.FileObject, java.lang.String, java.util.Map<java.lang.String, java.lang.Object>)
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 Valuesprotected 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/OBuilt on July 28 2012. | Portions Copyright 1997-2012 Sun Microsystems, Inc. All rights reserved.