org.eclipse.xtext.ui.editor.templates
Class XtextTemplateContext
java.lang.Object
org.eclipse.jface.text.templates.TemplateContext
org.eclipse.jface.text.templates.DocumentTemplateContext
org.eclipse.xtext.ui.editor.templates.XtextTemplateContext
public class XtextTemplateContext
- extends org.eclipse.jface.text.templates.DocumentTemplateContext
Represents an extended version of class DocumentTemplateContext to provide additional Xtext related
information and services for resolving a Template. Furthermore it fixes the indentation
of the applied template.
- Author:
- Michael Clay - Initial contribution and API, Sebastian Zarnekow
| Methods inherited from class org.eclipse.jface.text.templates.DocumentTemplateContext |
canEvaluate, getCompletionLength, getCompletionOffset, getDocument, getEnd, getKey, getStart, setCompletionLength, setCompletionOffset |
| Methods inherited from class org.eclipse.jface.text.templates.TemplateContext |
getContextType, getVariable, isReadOnly, setReadOnly, setVariable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XtextTemplateContext
public XtextTemplateContext(org.eclipse.jface.text.templates.TemplateContextType type,
org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.Position position,
ContentAssistContext contentAssistContext,
IScopeProvider scopeProvider)
getContentAssistContext
public ContentAssistContext getContentAssistContext()
- Returns:
- the contentAssistContext
getScopeProvider
public IScopeProvider getScopeProvider()
- Returns:
- the linkingCandidatesService
evaluate
public org.eclipse.jface.text.templates.TemplateBuffer evaluate(org.eclipse.jface.text.templates.Template template)
throws org.eclipse.jface.text.BadLocationException,
org.eclipse.jface.text.templates.TemplateException
- Description copied from class:
org.eclipse.jface.text.templates.TemplateContext
- Evaluates the template in this context and returns a template buffer.
Evaluation means translating the template into a TemplateBuffer,
resolving the defined variables in this context and possibly formatting
the resolved buffer.
- Overrides:
evaluate in class org.eclipse.jface.text.templates.DocumentTemplateContext
- Parameters:
template - the template to evaluate
- Returns:
- returns the buffer with the evaluated template or
null if the buffer could not be created
- Throws:
org.eclipse.jface.text.BadLocationException - if evaluation fails due to concurrently changed documents etc.
org.eclipse.jface.text.templates.TemplateException - if the template specification is not valid
createTemplateTranslator
protected org.eclipse.jface.text.templates.TemplateTranslator createTemplateTranslator()