public final class CodeTemplateDescription extends Object
The CodeTemplateDescriptions can be obtained from
CodeTemplateSettings class that can be loaded from MimeLookup
for a particular mime type. See the example below.
Lookup l = MimeLookup.getLookup(MimePath.parse(mimePath)); CodeTemplateSettings cds = l.lookup(CodeTemplateSettings.class); ListcodeTemplates = cds.getCodeTemplateDescriptions();
IMPORTANT: There is a much more powerful API for working with editor
code templates in
Editor Code Templates
module. If you are retrieving this class from MimeLookup you should
probably use the Editor Code Templates API instead.
CodeTemplateSettings| Constructor and Description |
|---|
CodeTemplateDescription(String abbreviation,
String description,
String parametrizedText)
Creates a new code template description.
|
CodeTemplateDescription(String abbreviation,
String description,
String parametrizedText,
List<String> contexts,
String uniqueId)
Creates a new code template description.
|
CodeTemplateDescription(String abbreviation,
String description,
String parametrizedText,
List<String> contexts,
String uniqueId,
String mimePath)
Creates a new code template description.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Checks whether this code template is equal with a code template passed in
as the
obj parameter. |
String |
getAbbreviation()
Gets the abbreviation text that triggers expansion of this code template.
|
List<String> |
getContexts()
Gets the list of contexts that apply for this code template.
|
String |
getDescription()
Gets textual description of this code template.
|
String |
getMimePath()
Gets the mime path where this code template was registered.
|
String |
getParametrizedText()
Gets the code text of this code template.
|
String |
getUniqueId()
Gets an id that can be used for identifying this template.
|
int |
hashCode() |
String |
toString() |
public CodeTemplateDescription(String abbreviation, String description, String parametrizedText)
null for the contexts parameter.abbreviation - The abbreviation text that expands this code template.description - The code template's display text.parametrizedText - The actual code template that will get expanded when
a user writes the abbreviation in the editor.public CodeTemplateDescription(String abbreviation, String description, String parametrizedText, List<String> contexts, String uniqueId)
Usually clients do not need to create CodeTemplateDescriptions
by themselvs. Instead they use MimeLookup and CodeTemplateSettings
to access code templates registered in the system.
abbreviation - The abbreviation text that expands this code template.description - The code template's display text.
Can be nullparametrizedText - The actual code template that will get expanded when
a user writes the abbreviation in the editor.contexts - The list of context ids that apply for this code template.
Can be nulluniqueId - The id uniquely identifying this template. If you pass
non-null value, please make sure that it is really a unique
id for this template. Can be null.public CodeTemplateDescription(String abbreviation, String description, String parametrizedText, List<String> contexts, String uniqueId, String mimePath)
#CodeTemplates(String, String, String, List, String ,
but with additional mimePath parameter.abbreviation - The abbreviation text that expands this code template.description - The code template's display text.
Can be nullparametrizedText - The actual code template that will get expanded when
a user writes the abbreviation in the editor.contexts - The list of context ids that apply for this code template.
Can be nulluniqueId - The id uniquely identifying this template. If you pass
non-null value, please make sure that it is really a unique
id for this template. Can be null.mimePath - The mime path where this code template description was registered for.public String getAbbreviation()
The abbreviation text should be unique among all code templates defined for a one mime type so that each code template can be expanded individually.
public String getDescription()
null if this
code template has no descriptions.public String getParametrizedText()
public List<String> getContexts()
The actual identifiers are defined by each particular language (mime type) and can be different for different languages. The language defines contexts for its constructs such as loops, methods, classes, if-else blocks, etc. and than tags each code template available for that language with a context, where it is meaningful to apply the template.
public String getUniqueId()
Unique ids can be useful for tools importing and exporting code templates from other applications such as TextMate, etc.
null.public String getMimePath()
null if the registration mime
path is unknown.public boolean equals(Object obj)
obj parameter. By definition two code templates are
equal if all their fields are equal - ie. all abbreviation, description,
parametrizedText, contexts, uniqueId and mimePath fields are equal.Built on June 18 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.