com.borland.primetime.insight.template
Class TemplateManager
java.lang.Object
|
+--com.borland.primetime.insight.template.TemplateManager
- public class TemplateManager
- extends java.lang.Object
This class manages CodeTemplates. There should be one static instance of
this class in the system, and it can be accessed through its static members.
Method Summary |
static java.lang.String |
formatTemplateString(java.lang.String template)
Format the incoming string, which should be a template
string, to the following specifications:
- all leading spaces are converted by taking the number
of leading spaces, dividing them by two, and multiplying
them by the current block indent size. |
static CodeTemplate[] |
getStockTemplates()
Get the list of stock templates. |
static CodeTemplate[] |
getTemplates()
|
static void |
invoke(EditorPane editor)
|
static boolean |
isDeletedStockTemplate(java.lang.String name)
Was a stock template with the given name modified
or deleted? |
static boolean |
isStockTemplate(java.lang.String name)
Is there a non-deleted, non-modified stock template with
the given name. |
static boolean |
isValidTemplateName(java.lang.String text)
Return true if the specified text is a valid template name. |
static void |
setTemplates(CodeTemplate[] templates)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TEMPLATE_DELIMITERS
public static java.lang.String TEMPLATE_DELIMITERS
templateSet
protected static TemplateSet templateSet
invoke
public static void invoke(EditorPane editor)
isValidTemplateName
public static boolean isValidTemplateName(java.lang.String text)
- Return true if the specified text is a valid template name.
getTemplates
public static CodeTemplate[] getTemplates()
setTemplates
public static void setTemplates(CodeTemplate[] templates)
getStockTemplates
public static CodeTemplate[] getStockTemplates()
- Get the list of stock templates. Stock templates can be
deleted by the user, and the list returned by this function
does not contain any templates deleted by the user.
- Returns:
- The list of currently valid stock templates.
isStockTemplate
public static boolean isStockTemplate(java.lang.String name)
- Is there a non-deleted, non-modified stock template with
the given name. If this name matches a deleted or modified
stock template, this function will return false.
- Parameters:
The
- name of a template.- Returns:
- True if there does exist a non-deleted, non-modified
stock template with the given name, false otherwise.
isDeletedStockTemplate
public static boolean isDeletedStockTemplate(java.lang.String name)
- Was a stock template with the given name modified
or deleted?
- Parameters:
The
- name of a stock template.- Returns:
- True if there is a deleted stock template with
the given name, false otherwise.
formatTemplateString
public static java.lang.String formatTemplateString(java.lang.String template)
- Format the incoming string, which should be a template
string, to the following specifications:
- - all leading spaces are converted by taking the number
of leading spaces, dividing them by two, and multiplying
them by the current block indent size.
- - all opening curly braces are positioned according
to the current user preferences regarding code format.
- Parameters:
The
- incoming template string.- Returns:
- The formatted template string.