# Class GlobalTemplateVariables.Selection

java.lang.Object
org.eclipse.jface.text.templates.TemplateVariableResolver
org.eclipse.jface.text.templates.SimpleTemplateVariableResolver
org.eclipse.jface.text.templates.GlobalTemplateVariables.Selection

Direct Known Subclasses:
  `GlobalTemplateVariables.LineSelection, GlobalTemplateVariables.WordSelection`

Enclosing class:
  `GlobalTemplateVariables`

public static class GlobalTemplateVariables.Selection extends SimpleTemplateVariableResolver
The selection variable determines templates that work on a selection.

Since:
  3.6

## Constructor Summary

Constructors
Constructor
Description
`Selection(String name, String description)`
Creates a word selection variable.

## Method Summary

Modifier and Type
Method
Description
`protected String`
`resolve(TemplateContext context)`
Returns an instance of the type resolved by the receiver available in `context`.
`void`
`resolve(TemplateVariable variable, TemplateContext context)`
Resolves `variable` in `context`.

### Methods inherited from class SimpleTemplateVariableResolver

`isUnambiguous, setEvaluationString`

### Methods inherited from class TemplateVariableResolver

`getDescription, getType, resolveAll, setDescription, setType`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### Selection

public Selection(String name, String description)
Creates a word selection variable.

Parameters:
  `name` - the name of the variable
  `description` - the description of the variable

## Method Details

### resolve

protected String resolve(TemplateContext context)
Description copied from class: `TemplateVariableResolver`
Returns an instance of the type resolved by the receiver available in `context`. To resolve means to provide a binding to a concrete text object (a `String`) in the given context.

The default implementation looks up the type in the context.

Overrides:
  `resolve` in class `SimpleTemplateVariableResolver`
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

### resolve

public void resolve(TemplateVariable variable, TemplateContext context)
Description copied from class: `TemplateVariableResolver`
Resolves `variable` in `context`. To resolve means to find a valid binding of the receiver's type in the given `TemplateContext`. If the variable can be successfully resolved, its value is set using `TemplateVariable.setValues(String[])`.

Overrides:
  `resolve` in class `TemplateVariableResolver`
Parameters:
  `variable` - the variable to resolve
  `context` - the context in which variable is resolved