org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractContentAssistUiTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: N4JSContentAssistProcessor.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected CompletionProposalComputer createCompletionProposalComputer(ITextViewer viewer, int offset) {
	return new N4JSCompletionProposalComputer(this, viewer, offset, dataCollectors.dcCreateProposals());
}