|
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.TemplateCompletionProcessor
A completion processor that computes template proposals. Subclasses need to
provide implementations for getTemplates(String)
,
getContextType(ITextViewer, IRegion)
and getImage(Template)
.
Constructor Summary | |
TemplateCompletionProcessor()
|
Method Summary | |
ICompletionProposal[] |
computeCompletionProposals(ITextViewer viewer,
int offset)
Returns a list of completion proposals based on the specified location within the document that corresponds to the current cursor position within the text viewer. |
IContextInformation[] |
computeContextInformation(ITextViewer viewer,
int documentOffset)
Returns information about possible contexts based on the specified location within the document that corresponds to the current cursor position within the text viewer. |
protected TemplateContext |
createContext(ITextViewer viewer,
IRegion region)
Creates a concrete template context for the given region in the document. |
protected ICompletionProposal |
createProposal(Template template,
TemplateContext context,
Region region,
int relevance)
Creates a new proposal. |
protected String |
extractPrefix(ITextViewer viewer,
int offset)
Heuristically extracts the prefix used for determining template relevance from the viewer's document. |
char[] |
getCompletionProposalAutoActivationCharacters()
Returns the characters which when entered by the user should automatically trigger the presentation of possible completions. |
char[] |
getContextInformationAutoActivationCharacters()
Returns the characters which when entered by the user should automatically trigger the presentation of context information. |
IContextInformationValidator |
getContextInformationValidator()
Returns a validator used to determine when displayed context information should be dismissed. |
protected abstract TemplateContextType |
getContextType(ITextViewer viewer,
IRegion region)
Returns the context type that can handle template insertion at the given region in the viewer's document. |
String |
getErrorMessage()
Returns the reason why this content assist processor was unable to produce any completion proposals or context information. |
protected abstract Image |
getImage(Template template)
Returns the image to be used for the proposal for template . |
protected int |
getRelevance(Template template,
String prefix)
Returns the relevance of a template given a prefix. |
protected abstract Template[] |
getTemplates(String contextTypeId)
Returns the templates valid for the context type specified by contextTypeId . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TemplateCompletionProcessor()
Method Detail |
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset)
IContentAssistProcessor
computeCompletionProposals
in interface IContentAssistProcessor
viewer
- the viewer whose document is used to compute the proposalsoffset
- an offset within the document for which completions should be computed
null
if no proposals are possibleprotected ICompletionProposal createProposal(Template template, TemplateContext context, Region region, int relevance)
The default implementation returns an instance of
TemplateProposal
. Subclasses may replace this method to provide
their own implementations.
template
- the template to be applied by the proposalcontext
- the context for the proposalregion
- the region the proposal applies torelevance
- the relevance of the proposal
ICompletionProposal
for
template
protected abstract Template[] getTemplates(String contextTypeId)
contextTypeId
.
contextTypeId
- the context type id
protected TemplateContext createContext(ITextViewer viewer, IRegion region)
DocumentTemplateContext
for the context type at the given location.
viewer
- the viewer for which the context is createdregion
- the region into document
for which the context is created
null
protected abstract TemplateContextType getContextType(ITextViewer viewer, IRegion region)
viewer
- the text viewerregion
- the region into the document displayed by viewer
null
if none existsprotected int getRelevance(Template template, String prefix)
template
- the template to compute the relevance forprefix
- the prefix after which content assist was requested
template
extractPrefix(ITextViewer, int)
protected String extractPrefix(ITextViewer viewer, int offset)
viewer
- the vieweroffset
- offset into document
getRelevance(Template, String)
protected abstract Image getImage(Template template)
template
.
template
- the template for which an image should be returned
template
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset)
IContentAssistProcessor
computeContextInformation
in interface IContentAssistProcessor
viewer
- the viewer whose document is used to compute the possible contextsdocumentOffset
- an offset within the document for which context information should be computed
null
if no context could be foundpublic char[] getCompletionProposalAutoActivationCharacters()
IContentAssistProcessor
getCompletionProposalAutoActivationCharacters
in interface IContentAssistProcessor
null
if no auto activation is desiredpublic char[] getContextInformationAutoActivationCharacters()
IContentAssistProcessor
getContextInformationAutoActivationCharacters
in interface IContentAssistProcessor
null
if no auto activation is desiredpublic String getErrorMessage()
IContentAssistProcessor
getErrorMessage
in interface IContentAssistProcessor
null
if no error occurredpublic IContextInformationValidator getContextInformationValidator()
IContentAssistProcessor
null
if the processor is
incapable of computing context information.
getContextInformationValidator
in interface IContentAssistProcessor
null
if the processor
is incapable of computing context information
|
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.