org.fife.ui.rsyntaxtextarea.templates
public interface CodeTemplate extends Cloneable, Comparable, Serializable
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.
StaticCodeTemplate
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Creates a deep copy of this template.
|
String |
getID()
Returns the ID of this code template.
|
void |
invoke(RSyntaxTextArea textArea)
Invokes this code template.
|
compareTo
Object clone()
String getID()
void invoke(RSyntaxTextArea textArea) throws BadLocationException
textArea
- The text area to operate on.BadLocationException
- If something bad happens.