Index

Creating Templates

J-- provides a mechanism to create code skeletons from template files. These template files (file extension .tpl) contain Java source code mixed up with macro processor directives. When the execution of the macro processor is started, text pieces of the template file will be copied according to the specified directives. Also some variables can be defined or specified from the user. The syntax is similar to the C/C++ preprocessor. The following subsections describe the available macro preprocessor directives.

Defining and Un- Defining Variables

The macro processor understands the following directives, that are related to variable manipulation:
 
Directive Description
#define var value Defines the variable var and assigns value to it. Unlike the C/C++ preprocessor variable may be defined multiple time.
#ifdef var Removes the definition of the variable var.
#pragma getbool var desc Defines a boolean variable var. The content of the variable will be keyed in from the user in a dialog box created from the IDE. desc is the description shown beside the GUI element.
#pragma getstring var desc Like #pragma getbool, but the variable is a string.
#pragma getfile var desc Like #pragma getbool, but the variable is a path to a file.

Some variables are allready defined at the start of the macro processor:
 
Name Description
__LINE__ Number of the current line; starts with one.
__FILE__ Filename of the template file; complete path.
__DATE__ Current date, format mmm dd yyyy.
__TIME__ Current time, format: hh:mm:ss.
__COMPILER__ Name of underlying compiler. 
__APPLET__ Name of the least recently compiled applet.
__VERSIONX_X Major version of the java runtime environment, the "X" are replaced by the current version number.
__VERSIONX_X_X Bugfix version of the java runtime environment, the "X" are replaced by the current version number.

And finally, some variables will be evaluated while or after end of execution of the macro processor:
 
Name Description
__RELPATH__ Suggested path of the resulting source file, relative to the project directory.
__NAME__ Suggested filename of the resulting source file.
__EXT__ Suggested filename extension of the resulting source file. This value is also used to determine the syntax coloring algorithm.
__ASSERT__ Flag; if defined, the IDE assumes that compilation of this file will lead to a class containing assert methods. If you don't know what this means, simply don't use this name. See Assert.tpl.
__TITLE__ This string will be used as frame title for all further dialog boxes.
__IMAGE__ Path to an image, which will be displayed in the left side of all further dialog boxes.
__BUTTON__ This string will be used as label for the OK button of all further dialog boxes.

Conditional Copy Directives

The macro processor directives control the conditional copying of source code.

Special Function Directives

see Available Templates