Package org.eclipse.jface.text.templates
Class SimpleTemplateVariableResolver
- java.lang.Object
-
- org.eclipse.jface.text.templates.TemplateVariableResolver
-
- org.eclipse.jface.text.templates.SimpleTemplateVariableResolver
-
- Direct Known Subclasses:
GlobalTemplateVariables.Cursor
,GlobalTemplateVariables.Date
,GlobalTemplateVariables.Dollar
,GlobalTemplateVariables.Selection
,GlobalTemplateVariables.Time
,GlobalTemplateVariables.User
,GlobalTemplateVariables.Year
public class SimpleTemplateVariableResolver extends TemplateVariableResolver
A simple template variable resolver, which always evaluates to a defined string.Clients may instantiate and extend this class.
- Since:
- 3.0
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleTemplateVariableResolver(String type, String description)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
isUnambiguous(TemplateContext context)
Returns alwaystrue
, since simple variables are normally unambiguous.protected String
resolve(TemplateContext context)
Returns an instance of the type resolved by the receiver available incontext
.void
setEvaluationString(String evaluationString)
Sets the string to which this variable evaluates.-
Methods inherited from class org.eclipse.jface.text.templates.TemplateVariableResolver
getDescription, getType, resolve, resolveAll, setDescription, setType
-
-
-
-
Method Detail
-
setEvaluationString
public final void setEvaluationString(String evaluationString)
Sets the string to which this variable evaluates.- Parameters:
evaluationString
- the evaluation string, may benull
.
-
resolve
protected String resolve(TemplateContext context)
Description copied from class:TemplateVariableResolver
Returns an instance of the type resolved by the receiver available incontext
. To resolve means to provide a binding to a concrete text object (aString
) in the given context.The default implementation looks up the type in the context.
- Overrides:
resolve
in classTemplateVariableResolver
- Parameters:
context
- the context in which to resolve the type- Returns:
- the name of the text object of this type, or
null
if it cannot be determined
-
isUnambiguous
protected boolean isUnambiguous(TemplateContext context)
Returns alwaystrue
, since simple variables are normally unambiguous.- Overrides:
isUnambiguous
in classTemplateVariableResolver
- Parameters:
context
- the context in which the resolved check should be evaluated- Returns:
true
-
-