Oracle Help for the WebContentsIndexSearchGlossaryView Topic


Using Code Templates

Code templates assist you in writing code more quickly and efficiently by inserting text for commonly used statements. For example, the "Iterate over a list" (itli) template inserts the following code:

     for (int i = 0; i < unknown.size(); i++)
     {
     Object object = (Object) unknown.get(i);
 
     }     

You can then modify the inserted text.

The predefined code templates are described here. You can also define your own code templates, in the Code Editorthen choose Code Templates page of the Preferences dialog.

To evoke a defined code template:

  1. In the file open in the editor, put the cursor at the point where the template is to be inserted.
  2. Type the shortcut associated with the template and then press Ctrl+Enter.

    The code as defined in the template is inserted in the source file. Import statements needed for the template, if any, are inserted at the top of the file.

Note: Ctrl+Enter is the accelerator assigned in the default keymap. You can assign an alternative.


Customizing Code Templates for the Source Editor

Recording and Playing Back Macros in Source Files

About the Java Source Editor
About the XML Source Editor
About Code Insight

Reference: JDeveloper Code Templates