|
Eclipse Platform Release 3.1 |
|||||||||||
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 TemplateVariable
s.
The EBNF grammar of a valid string is as follows:
template := (text | escape)*.
text := character - dollar.
escape := dollar ('{' identifier '}' | dollar).
dollar := '$'.
Clients may extend the createVariable
method of this class.
Constructor Summary | |
---|---|
TemplateTranslator()
|
Method Summary | |
---|---|
protected TemplateVariable |
createVariable(String 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
otherwisepublic 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.
null
if there was an error.
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.
null
if there was an error.
TemplateException
- if translation failedgetErrorMessage()
protected TemplateVariable createVariable(String 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.1 |
|||||||||||
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, 2005. All rights reserved.