IntelliJ IDEA 13.1.0 Web Help

IntelliJ IDEA suggests a simplified way of creating Groovy classes, interfaces, enumerations or annotations, with all the required infrastructure. The stub generated from a file template is a file with the corresponding extension (.groovy). This file contains a package statement, a commented header section, and a class declaration.

To create Groovy class, interface, enumeration or annotation
  1. In the Project tool window, select the destination package. Choose File | New or press Alt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertAlt+InsertCtrl+N or Alt+InsertAlt+InsertAlt+InsertCommand N or Control EnterControl N or Control EnterCommand N or Control Enter.

    Alternatively, right-click the package and select New from the context menu.

  2. In the New menu, select Groovy Class.

    createGroovyClass1

  3. In the New Groovy Class dialog:
    1. Type the name of the entity you are creating in the Name field. Don't type the file name extension.
    2. Select the kind of symbol to be created from the Kind list. Note that you can use the UpUpUpUpUp or Ctrl+PUpUpUpUpUp or Control PUpUp or Control P and DownDownDownDownDown or Ctrl+NDownDownDownDownDown or Control NDownDown or Control N arrow keys to browse the contents of this list.
    3. Click OK.

    createGroovyClass2

IntelliJ IDEA generates a file with the specified name and the corresponding extension (.groovy), and opens this file in the editor.

Tip

When specifying the name of the symbol to be created, you can type the names of packages separated with dots in front of the symbol name.

createGroovyClass3

As a result, IntelliJ IDEA, in addition to creating the symbol, will also make the necessary changes to packages. Depending on the situation, the current package may be renamed or an appropriate package structure may be generated.

createGroovyClass4

Note

Since Groovy syntax allows multiple classes in a single file, you can just type as many class declarations in the editor, as required.

See Also

Concepts:

Procedures:

Web Resources: