CodeTemplate
Date: 2017-02-11

org.fife.ui.rsyntaxtextarea.templates

## Interface CodeTemplate

- All Superinterfaces:
    java.lang.Cloneable, java.lang.Comparable<CodeTemplate>, java.io.Serializable
  All Known Implementing Classes:
    AbstractCodeTemplate, StaticCodeTemplate

      public interface CodeTemplate
      extends java.lang.Cloneable, java.lang.Comparable<CodeTemplate>, java.io.Serializable

  A "code template" is a kind of macro for commonly-typed code. It associates a short identifier with a longer code snippet, then when the code template is enabled and the short identifier is typed, it is replaced with the longer code snippet.

  For example, you can associate the identifier `forb` (short for "for-block") with the following code:

         for (<caret>) {

         }

  Then, whenever you type `forb` followed by a trigger (e.g., a space) into a text area with this `CodeTemplate`, the code snippet is added in place of `forb`. Further, the caret is placed at the position denoted by `<caret>`.

  Static text replacements are done with `StaticCodeTemplate`. Dynamic templates can also be created and used.

  See Also:
    `StaticCodeTemplate`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `clone()` Creates a deep copy of this template.
    `java.lang.String` | `getID()` Returns the ID of this code template.
    `void` | `invoke(RSyntaxTextArea textArea)` Invokes this code template.

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Method Detail

    - #### clone

          java.lang.Object clone()

      Creates a deep copy of this template.
      Returns:
        A deep copy of this template.

    - #### getID

          java.lang.String getID()

      Returns the ID of this code template.
      Returns:
        The template's ID.

    - #### invoke

          void invoke(RSyntaxTextArea textArea)
                      throws javax.swing.text.BadLocationException

      Invokes this code template. The changes are made to the given text area.
      Parameters:
        `textArea` - The text area to operate on.
      Throws:
        `javax.swing.text.BadLocationException` - If something bad happens.