use of org.eclipse.xtext.xbase.ui.imports.ReplaceConverter in project xtext-eclipse by eclipse.
the class XbaseProposalProvider method proposeFavoriteStaticFeatures.
/**
* @since 2.17
*/
protected void proposeFavoriteStaticFeatures(EObject context, ContentAssistContext contentAssistContext, ICompletionProposalAcceptor acceptor, IScope scopedFeatures) {
Function<IEObjectDescription, ICompletionProposal> proposalFactory = getProposalFactory(getFeatureCallRuleName(), contentAssistContext);
IReplacementTextApplier textApplier = new FQNImporter(contentAssistContext.getResource(), contentAssistContext.getViewer(), scopedFeatures, qualifiedNameConverter, qualifiedNameValueConverter, importSectionFactory, replaceConverter);
Function<IEObjectDescription, ICompletionProposal> importAddingProposalFactory = input -> {
ICompletionProposal proposal = proposalFactory.apply(input);
if (proposal instanceof ConfigurableCompletionProposal) {
ConfigurableCompletionProposal castedProposal = (ConfigurableCompletionProposal) proposal;
// Add textApplier to introduce imports if necessary
((ConfigurableCompletionProposal) proposal).setTextApplier(textApplier);
return castedProposal;
}
return proposal;
};
getCrossReferenceProposalCreator().lookupCrossReference(scopedFeatures, context, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, acceptor, getFeatureDescriptionPredicate(contentAssistContext), importAddingProposalFactory);
}
Aggregations