You can also use macros in your templates to have various strings automatically generated when you create objects from template.
Macros are called in templates in the form __MacroName__
(with two underscores before and two underscores after the macro name).
The IDE includes several uneditable macros and one editable macro. You can also create your own macros.
The IDE has the following uneditable macros:
__DATE__
- Substitutes the date of template creation.__TIME__
- Substitutes the time of template creation.__NAME__
- Substitutes the name of the class (without extension). __PACKAGE__
- Substitutes the name of the package that the class is in. __PACKAGE_SLASHES__
- Substitutes the name of the class's package, but delimited with slashes (/) instead of periods (.).__PACKAGE_AND_NAME__
- Substitutes the name of the package and the file, substituted in the form
packageName.fileName
. If the file resides in the root of the filesystem, it
is substituted only with the filename.__PACKAGE_AND_NAME_SLASHES__
- Works the same as PACKAGE_AND_NAME
but
delimits names with slashes (/) instead of periods (.).__QUOTES__
- Substitutes a double quote mark ("). This macro is necessary if you want to place a macro between quote marks.
If you enter quotes directly, text substitution for any macros occurring with the quotes will not be performed when an
object is created from the template.Many templates in the IDE use the __USER__
macro, which substitutes the user name in files created from.
To edit the __USER__
macro:
USER
and click OK.To create a new macros for use in templates:
MacroName=Value
and click OK.
When you define the macro, do not place the underscore characters at the beginning and end of the macro name.
See also | |
---|---|
Creating a Template Modifying a Template Creating a Template for a Group of Files |