use of org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer in project dsl-devkit by dsldevkit.
the class AbstractContentAssistUiTest method createCompletionProposalComputer.
/**
* Helper function to find the correct CompletionProposalComputer for the given offset.
*
* @param offset
* offset in test file
* @return language and offset specific content assist proposal computer
*/
private CompletionProposalComputer createCompletionProposalComputer(final int offset) {
XtextSourceViewerConfiguration configuration = getEditor().getXtextSourceViewerConfiguration();
IContentAssistant contentAssistant = configuration.getContentAssistant(getViewer());
IContentAssistProcessor contentAssistProcessor;
try {
contentAssistProcessor = contentAssistant.getContentAssistProcessor(getDocument().getContentType(offset));
} catch (BadLocationException e) {
contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
}
if (contentAssistProcessor == null) {
contentAssistProcessor = getTestUtil().get(IContentAssistProcessor.class);
}
return new CompletionProposalComputer((State) contentAssistProcessor, (ITextViewer) getViewer(), offset);
}
Aggregations