use of org.eclipse.jface.text.contentassist.ICompletionProposalExtension in project xtext-eclipse by eclipse.
the class ContentAssistProcessorTestBuilder method appendAndApplyProposal.
protected ContentAssistProcessorTestBuilder appendAndApplyProposal(ICompletionProposal proposal, ISourceViewer sourceViewer, String model, int position) throws Exception {
IDocument document = sourceViewer.getDocument();
int offset = position;
if (model != null) {
document.set(getModel() + model);
offset += model.length();
}
if (proposal instanceof ICompletionProposalExtension2) {
ICompletionProposalExtension2 proposalExtension2 = (ICompletionProposalExtension2) proposal;
proposalExtension2.apply(sourceViewer, (char) 0, SWT.NONE, offset);
} else if (proposal instanceof ICompletionProposalExtension) {
ICompletionProposalExtension proposalExtension = (ICompletionProposalExtension) proposal;
proposalExtension.apply(document, (char) 0, offset);
} else {
proposal.apply(document);
}
return reset().append(document.get());
}
Aggregations