com.borland.primetime.insight.template
Class CodeTemplate

java.lang.Object
  |
  +--com.borland.primetime.insight.template.CodeTemplate

public class CodeTemplate
extends java.lang.Object
implements java.lang.Comparable

A CodeTemplate represents a fragment of code, and has an associated name (shortcut) and description. They are used to quickly insert a commonly used block of text into an editor.


Field Summary
protected  java.lang.String description
           
protected  java.lang.String expandedString
           
protected  java.lang.String templateName
           
 
Constructor Summary
CodeTemplate(java.lang.String templateName)
          Create a new CodeTemplate
CodeTemplate(java.lang.String templateName, java.lang.String description)
          Create a new CodeTemplate
 
Method Summary
 int compareTo(java.lang.Object anotherObject)
          Compare another object to this one.
 java.lang.String getDescription()
          Get the description for this template.
 java.lang.String getExpandedString()
          Get the expandedString for this template.
 java.lang.String getTemplateName()
          Get the name of this template.
 void setDescription(java.lang.String description)
           
 void setExpandedString(java.lang.String expandedString)
          Set the String that will replace the code template name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

templateName

protected java.lang.String templateName

description

protected java.lang.String description

expandedString

protected java.lang.String expandedString
Constructor Detail

CodeTemplate

public CodeTemplate(java.lang.String templateName,
                    java.lang.String description)
Create a new CodeTemplate
Parameters:
templateName - The name of the template.

CodeTemplate

public CodeTemplate(java.lang.String templateName)
Create a new CodeTemplate
Parameters:
templateName - The name of the template.
Method Detail

getTemplateName

public java.lang.String getTemplateName()
Get the name of this template.

getDescription

public java.lang.String getDescription()
Get the description for this template.

setDescription

public void setDescription(java.lang.String description)

getExpandedString

public java.lang.String getExpandedString()
Get the expandedString for this template. The string returned may include embedded newlines and the pipe character ('|'), and is intended to be parsed by the CodeTemplateManager.

setExpandedString

public void setExpandedString(java.lang.String expandedString)
Set the String that will replace the code template name. A sample expandedString follows:
   if (|) {
   }
   else {
   }
 
The newline characters, '\n', are embedded within the string. If there is to be a newline after the last line of the expandedString, it must be explicitely included. The pipe character, '|', denotes the caret position after the template is expanded.

compareTo

public int compareTo(java.lang.Object anotherObject)
Compare another object to this one.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
anotherObject - The object to compare. If anotherObject is a CodeTemplate, this method will compare their templateNames. If anotherObject is a String, this method will compare this object's templateName tag with the String.