Class StaticCodeTemplate

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparable<CodeTemplate>, CodeTemplate

    public class StaticCodeTemplate
    extends AbstractCodeTemplate
    A code template that inserts static text before and after the caret.

    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>.
    See Also:
    CodeTemplate, Serialized Form
    • Constructor Detail

      • StaticCodeTemplate

        public StaticCodeTemplate()
        Constructor. This constructor only exists to support persistance through serialization.
      • StaticCodeTemplate

        public StaticCodeTemplate​(String id,
                                  String beforeCaret,
                                  String afterCaret)
        Constructor.
        Parameters:
        id - The ID of this code template.
        beforeCaret - The text to place before the caret.
        afterCaret - The text to place after the caret.
    • Method Detail

      • setAfterCaretText

        public void setAfterCaretText​(String afterCaret)
        Sets the text to place after the caret.
        Parameters:
        afterCaret - The text.
        See Also:
        getAfterCaretText()
      • setBeforeCaretText

        public void setBeforeCaretText​(String beforeCaret)
        Sets the text to place before the caret.
        Parameters:
        beforeCaret - The text.
        See Also:
        getBeforeCaretText()
      • toString

        public String toString()
        Returns a string representation of this template for debugging purposes.
        Overrides:
        toString in class Object
        Returns:
        A string representation of this template.