Download Forte for Java (Community Edition) User's Guide
Transcript
Chapter 11: Configuring and customizing the IDE
•
__NAME__ – name of the class.
•
__PACKAGE__ – name of the package that the class is in.
•
__PACKAGE_SLASHES__ – name of the class’s package, but delimited with slashes
(/) instead of periods (.).
•
__QUOTES__ – inserts a double quote mark ("). This macro is necessary if you want
to place a macro between quote marks. If you enter directly quotes, text substitution for
any macros occurring with the quotes will not be performed when an object is created
from the template.
Creating and editing macros
The IDE also has the USER macro (signifying the user of the IDE) which you can edit in the
Strings Table property editor. In addition, you can add your own macros.
To edit macros or create new macros for use in templates:
1
Choose Project | Settings... from the main menu to open the Project Settings window.
2
Select the Java Sources node, select the Strings Table property, and click the ...
button to open its custom property editor.
You will see a list of the macros in the form MacroName=Value (without the two
underscores both before and after MacroName.
3
Make any desired changes to the macro values or add new macros to the list.
Advanced macro feature
The IDE also provides a feature enabling you to determine the suffix in the instantiated
object conditionally. The syntax for this feature is
__MacroName$Param1$Param2$Param3__
where Param2 replaces Param1 if the value of MacroName ends in Param1. If the value of
MacroName does not end in Param1, Param3 is returned as the value for the macro.
For example, if you enter the following into a template:
__Name$Impl$Spec$Unknown__
and you create an object from the template called MyClassImpl, the text MyClassSpec
would be returned by the macro in the new object. If the object you created was merely called
MyClass, the value Unknown would be returned.
Tip: Macros are particular useful when you create groups using the Group of Files template.
203