|
org.netbeans.modules.editor.settings/1 1.12.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.api.editor.settings.CodeTemplateDescription
public final class CodeTemplateDescription
The definition of a code template. A code template is basically a piece of code with an abbreviation associated to it. When a user types the abbreviation to the editor and presses the expansion key the code associated with the abbreviation gets expanded. The code can contain various parameter that the user can enter during the expansion.
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();
CodeTemplateSettings| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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 |
getParametrizedText()
Gets the code text of this code template. |
String |
getUniqueId()
Gets an id that can be used for identifying this template. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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 toString()
toString in class Object
|
org.netbeans.modules.editor.settings/1 1.12.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||