|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.text.templates.TemplateTranslator
The template translator translates a string into a template buffer. Regions marked as variables
are translated into TemplateVariables.
The EBNF grammar of a valid string is as follows:
template := (text | escape)*.
text := character - dollar.
escape := dollar ('{' variable '}' | dollar).
dollar := '$'.
variable := identifier | identifier ':' type.
type := qualifiedname | qualifiedname '(' arguments ')'.
arguments := (qualifiedname ',')* qualifiedname.
qualifiedname := (identifier '.')* identifier.
Clients may only replace the createVariable method of this class.
| Constructor Summary | |
|---|---|
TemplateTranslator()
|
|
| Method Summary | |
|---|---|
protected TemplateVariable |
createVariable(String type,
String name,
int[] offsets)
Deprecated. as of 3.3 use createVariable(TemplateVariableType, String, int[]) instead |
protected TemplateVariable |
createVariable(TemplateVariableType type,
String name,
int[] offsets)
Hook method to create new variables. |
String |
getErrorMessage()
Returns an error message if an error occurred for the last translation, null
otherwise. |
TemplateBuffer |
translate(String string)
Translates a template string to TemplateBuffer. |
TemplateBuffer |
translate(Template template)
Translates a template to a TemplateBuffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TemplateTranslator()
| Method Detail |
public String getErrorMessage()
null
otherwise.
null otherwise
public TemplateBuffer translate(Template template)
throws TemplateException
TemplateBuffer. null is returned if
there was an error. getErrorMessage() retrieves the associated error message.
template - the template to translate.
TemplateException - if translation failedgetErrorMessage()
public TemplateBuffer translate(String string)
throws TemplateException
TemplateBuffer. null is
returned if there was an error. getErrorMessage() retrieves the associated
error message.
string - the string to translate.
TemplateException - if translation failedgetErrorMessage()
protected TemplateVariable createVariable(String type,
String name,
int[] offsets)
createVariable(TemplateVariableType, String, int[]) instead
Clients may replace this method.
type - the type of the new variable.name - the name of the new variable.offsets - the offsets where the variable occurs in the template
TemplateVariable
protected TemplateVariable createVariable(TemplateVariableType type,
String name,
int[] offsets)
Clients may replace this method.
type - the type of the new variable.name - the name of the new variable.offsets - the offsets where the variable occurs in the template
TemplateVariable
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.