Book Image

IntelliJ IDEA Essentials

By : Jaroslaw Krochmalski
Book Image

IntelliJ IDEA Essentials

By: Jaroslaw Krochmalski

Overview of this book

Table of Contents (17 chapters)
IntelliJ IDEA Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Live Templates


Live Templates lets you use the editor to insert frequently used code blocks into your source code.

Live Templates can be simple, parameterized, and surrounded. A simple template contains code blocks that will be expanded and inserted into the editor, replacing the abbreviation. Parameterized templates, on the other hand, have variables that will be filled automatically by IntelliJ IDEA or will prompt the user for input.

When a parameterized template is invoked and expanded in the editor, IntelliJ IDEA will suggest some predefined values for the defined variables. The surrounding templates expand before and after the selected code block. To insert a live template into the editor, just type the abbreviation and press the expand key (Tab is the default key). The other way to insert a template is to press Ctrl + J (PC) or cmd + J (Mac) and select the template from the pop-up list. As always, you can filter the list by typing.

The pop-up list will contain Live Templates that...