Java Code Examples for org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext#getResource()
The following examples show how to use
org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext#getResource() .
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: XbaseProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @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); }
Example 2
Source File: ImportingTypesProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected IReplacementTextApplier createTextApplier(ContentAssistContext context, IScope typeScope, IQualifiedNameConverter qualifiedNameConverter, IValueConverter<String> valueConverter) { if (EcoreUtil2.getContainerOfType(context.getCurrentModel(), XImportSection.class) != null) return null; return new FQNImporter(context.getResource(), context.getViewer(), typeScope, qualifiedNameConverter, valueConverter, importSectionFactory, replaceConverter); }
Example 3
Source File: JdtTypesProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected ConfigurableCompletionProposal.IReplacementTextApplier createTextApplier( ContentAssistContext context, IScope typeScope, IQualifiedNameConverter qualifiedNameConverter, IValueConverter<String> valueConverter) { return new FQNShortener(context.getResource(), typeScope, qualifiedNameConverter, valueConverter); }