|
Eclipse Platform Release 3.0 |
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.eclipse.jface.text.templates.TemplateContext
org.eclipse.jface.text.templates.DocumentTemplateContext
A typical text based document template context.
Clients may instantiate and extend this class.
| Constructor Summary | |
DocumentTemplateContext(TemplateContextType type,
IDocument document,
int completionOffset,
int completionLength)
Creates a document template context. |
|
| Method Summary | |
boolean |
canEvaluate(Template template)
Tests if the specified template can be evaluated in this context. |
TemplateBuffer |
evaluate(Template template)
Evaluates the template in this context and returns a template buffer. |
int |
getCompletionLength()
Returns the completion length within the string of the context. |
int |
getCompletionOffset()
Returns the completion offset within the string of the context. |
IDocument |
getDocument()
Returns the document. |
int |
getEnd()
Returns the end offset of the keyword. |
String |
getKey()
Returns the keyword which triggered template insertion. |
int |
getStart()
Returns the beginning offset of the keyword. |
protected void |
setCompletionLength(int newLength)
Sets the completion length. |
protected void |
setCompletionOffset(int newOffset)
Sets the completion offset. |
| 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 |
| Constructor Detail |
public DocumentTemplateContext(TemplateContextType type,
IDocument document,
int completionOffset,
int completionLength)
type - the context typedocument - the document this context applies tocompletionOffset - the completion offset (for usage in content
assist)completionLength - the completion length| Method Detail |
public IDocument getDocument()
public int getCompletionOffset()
protected void setCompletionOffset(int newOffset)
newOffset - the new completion offsetpublic int getCompletionLength()
protected void setCompletionLength(int newLength)
newLength - the new completion lengthpublic String getKey()
public int getStart()
public int getEnd()
public boolean canEvaluate(Template template)
TemplateContextExamples are templates defined for a different context (e.g. a javadoc template cannot be evaluated in Java context).
canEvaluate in class TemplateContexttemplate - the Template to check
true if template can be evaluated
in this context, false otherwise
public TemplateBuffer evaluate(Template template)
throws BadLocationException,
TemplateException
TemplateContext
Evaluation means translating the template into a TemplateBuffer,
resolving the defined variables in this context and possibly formatting
the resolved buffer.
evaluate in class TemplateContexttemplate - the template to evaluate
null if the buffer could not be created
TemplateException - if the template specification is not valid
BadLocationException - if evaluation fails due to concurrently changed documents etc.
|
Eclipse Platform Release 3.0 |
||||||||||
| 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, 2004. All rights reserved.