Class TemplateProposalProvider
- java.lang.Object
-
- com.e1c.g5.v8.dt.lcore.ui.templates.contentassist.TemplateProposalProvider
-
- All Implemented Interfaces:
org.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider
- Direct Known Subclasses:
BslTemplateProposalProvider
public abstract class TemplateProposalProvider extends Object implements org.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider
Abstract implementation of proposal provider
-
-
Constructor Summary
Constructors Constructor Description TemplateProposalProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected int
comparePrefixes(String prefix1, String prefix2, String name)
Compares prefixes to get the most common one for given stringvoid
createTemplates(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext[] contexts, org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor acceptor)
Creates templates with given contexts to analyze the best one and to not create many proposal for one template many proposals with different contextsvoid
createTemplates(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, org.eclipse.xtext.ui.editor.contentassist.ITemplateAcceptor acceptor)
protected org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext
getBestContextForTemplate(ITemplate template, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext[] contexts)
Returns the best context for given template from given contexts, ornull
if neither of contexts is acceptableprotected abstract TemplateStorageManager
getStorageManager(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context)
Returns storage manager of templatesprotected abstract ITemplateProcessor
getTemplateProcessor()
Returns template processor to process given templatesprotected boolean
hasAcceptablePrefix(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, ITemplate template)
Checks if prefix is acceptable in given context for given template
-
-
-
Method Detail
-
createTemplates
public void createTemplates(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, org.eclipse.xtext.ui.editor.contentassist.ITemplateAcceptor acceptor)
- Specified by:
createTemplates
in interfaceorg.eclipse.xtext.ui.editor.contentassist.ITemplateProposalProvider
-
createTemplates
public void createTemplates(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext[] contexts, org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor acceptor)
Creates templates with given contexts to analyze the best one and to not create many proposal for one template many proposals with different contexts- Parameters:
contexts
- The possible contexts, cannot benull
acceptor
- The acceptor to accept proposals, cannot benull
-
getBestContextForTemplate
protected org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext getBestContextForTemplate(ITemplate template, org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext[] contexts)
Returns the best context for given template from given contexts, ornull
if neither of contexts is acceptable- Parameters:
template
- The template to find context for, cannot benull
contexts
- The contexts to choose from , cannot benull
- Returns:
- The best context for the given template, can be
null
if neither of contexts is acceptable
-
hasAcceptablePrefix
protected boolean hasAcceptablePrefix(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context, ITemplate template)
Checks if prefix is acceptable in given context for given template- Parameters:
context
- The context of invocation, cannot benull
template
- The template to check, cannot benull
- Returns:
-
comparePrefixes
protected int comparePrefixes(String prefix1, String prefix2, String name)
Compares prefixes to get the most common one for given string- Parameters:
prefix1
- The first prefix, cannot benull
prefix2
- The second prefix, cannot benull
name
- The string to find the most common prefix for, cannot benull
- Returns:
-
getStorageManager
protected abstract TemplateStorageManager getStorageManager(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext context)
Returns storage manager of templates- Parameters:
context
- The provided context, cannot benull
- Returns:
- The instance of template storage manager, cannot be
null
-
getTemplateProcessor
protected abstract ITemplateProcessor getTemplateProcessor()
Returns template processor to process given templates- Returns:
- The instance of template processor, cannot be
null
-
-