Package org.eclipse.ease.ui.completion
Class CodeCompletionAggregator
java.lang.Object
org.eclipse.ease.ui.completion.CodeCompletionAggregator
- All Implemented Interfaces:
org.eclipse.jface.fieldassist.IContentProposalProvider
public class CodeCompletionAggregator extends Object implements org.eclipse.jface.fieldassist.IContentProposalProvider
Dispatcher class create code completion proposals.
First checks all registered
ICompletionProvider
objects to get the ICompletionContext
for the desired line.
Then uses all registered ICompletionProvider
objects to calculate the IContentProposal
array for getProposals(String, int)
.
TODO: Refactor to use multi-threading.-
Field Summary
Fields Modifier and Type Field Description static String
ATTRIBUTE_CLASS
String constant for class attribute of codeCompletionProvider extension.static String
ATTRIBUTE_SCRIPT_TYPE
String constant for script type attribute of codeCompletionProvider extension.static String
COMPLETION_PROCESSOR
String constant for codeCompletionProvider extension point. -
Constructor Summary
Constructors Constructor Description CodeCompletionAggregator()
-
Method Summary
Modifier and Type Method Description void
addCompletionProvider(ICompletionProvider completionProvider)
char[]
getActivationChars()
List<org.eclipse.jface.text.contentassist.ICompletionProposal>
getCompletionProposals(Object resource, String relevantText, int insertOffset, int selectionRange, org.eclipse.core.runtime.IProgressMonitor monitor)
Calculate relevant completion proposals.org.eclipse.jface.fieldassist.IContentProposal[]
getProposals(String contents, int position)
void
setCodeParser(ICodeParser codeParser)
Setter method for ICompletionAnalyzer.void
setScriptEngine(IScriptEngine scriptEngine)
Sets the given script engine for all registered completion providers.void
setScriptType(ScriptType scriptType)
-
Field Details
-
COMPLETION_PROCESSOR
String constant for codeCompletionProvider extension point.- See Also:
- Constant Field Values
-
ATTRIBUTE_SCRIPT_TYPE
String constant for script type attribute of codeCompletionProvider extension.- See Also:
- Constant Field Values
-
ATTRIBUTE_CLASS
String constant for class attribute of codeCompletionProvider extension.- See Also:
- Constant Field Values
-
-
Constructor Details
-
CodeCompletionAggregator
public CodeCompletionAggregator()
-
-
Method Details
-
setCodeParser
Setter method for ICompletionAnalyzer.- Parameters:
codeParser
-ICodeParser
for completion calculation.
-
getActivationChars
public char[] getActivationChars() -
setScriptEngine
Sets the given script engine for all registered completion providers.- Parameters:
scriptEngine
-IScriptEngine
to be set.
-
setScriptType
-
addCompletionProvider
-
getCompletionProposals
public List<org.eclipse.jface.text.contentassist.ICompletionProposal> getCompletionProposals(Object resource, String relevantText, int insertOffset, int selectionRange, org.eclipse.core.runtime.IProgressMonitor monitor)Calculate relevant completion proposals.- Parameters:
resource
- resource that contains relevantText. May benull
relevantText
- text that is relevant for completion calculationinsertOffset
- cursor position within relevatTextselectionRange
-monitor
- job monitor for calculation termination- Returns:
-
getProposals
public org.eclipse.jface.fieldassist.IContentProposal[] getProposals(String contents, int position)- Specified by:
getProposals
in interfaceorg.eclipse.jface.fieldassist.IContentProposalProvider
-