Search in sources :

Example 1 with QualifiedNameValueConverter

use of org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter 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);
}
Also used : XBasicForLoopExpression(org.eclipse.xtext.xbase.XBasicForLoopExpression) RewritableImportSection(org.eclipse.xtext.xbase.imports.RewritableImportSection) LightweightTypeReference(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReference) StyledString(org.eclipse.jface.viewers.StyledString) IValueConverter(org.eclipse.xtext.conversion.IValueConverter) Inject(com.google.inject.Inject) XBinaryOperation(org.eclipse.xtext.xbase.XBinaryOperation) ILeafNode(org.eclipse.xtext.nodemodel.ILeafNode) JvmExecutable(org.eclipse.xtext.common.types.JvmExecutable) XbaseQualifiedNameValueConverter(org.eclipse.xtext.xbase.conversion.XbaseQualifiedNameValueConverter) Logger(org.apache.log4j.Logger) XMemberFeatureCall(org.eclipse.xtext.xbase.XMemberFeatureCall) ContentAssistContext(org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext) FluentIterable(com.google.common.collect.FluentIterable) Map(java.util.Map) OperatorMapping(org.eclipse.xtext.xbase.scoping.featurecalls.OperatorMapping) SyntaxFilteredScopes(org.eclipse.xtext.xbase.scoping.SyntaxFilteredScopes) ValueConverterException(org.eclipse.xtext.conversion.ValueConverterException) IContextInformation(org.eclipse.jface.text.contentassist.IContextInformation) INode(org.eclipse.xtext.nodemodel.INode) IQualifiedNameConverter(org.eclipse.xtext.naming.IQualifiedNameConverter) CrossReference(org.eclipse.xtext.CrossReference) JvmOperation(org.eclipse.xtext.common.types.JvmOperation) ICompletionProposalAcceptor(org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor) IIdentifiableElementDescription(org.eclipse.xtext.xbase.scoping.batch.IIdentifiableElementDescription) QualifiedName(org.eclipse.xtext.naming.QualifiedName) Function(com.google.common.base.Function) Group(org.eclipse.xtext.Group) XbasePackage(org.eclipse.xtext.xbase.XbasePackage) Strings(org.eclipse.xtext.util.Strings) JvmFormalParameter(org.eclipse.xtext.common.types.JvmFormalParameter) EObject(org.eclipse.emf.ecore.EObject) XFeatureCall(org.eclipse.xtext.xbase.XFeatureCall) ICompositeNode(org.eclipse.xtext.nodemodel.ICompositeNode) XClosure(org.eclipse.xtext.xbase.XClosure) SimpleScope(org.eclipse.xtext.scoping.impl.SimpleScope) Keyword(org.eclipse.xtext.Keyword) List(java.util.List) JvmTypeReference(org.eclipse.xtext.common.types.JvmTypeReference) Predicate(com.google.common.base.Predicate) StaticFeatureDescription(org.eclipse.xtext.xbase.scoping.batch.StaticFeatureDescription) GrammarUtil(org.eclipse.xtext.GrammarUtil) IBatchTypeResolver(org.eclipse.xtext.xbase.typesystem.IBatchTypeResolver) IResolvedTypes(org.eclipse.xtext.xbase.typesystem.IResolvedTypes) XtypePackage(org.eclipse.xtext.xtype.XtypePackage) XBlockExpression(org.eclipse.xtext.xbase.XBlockExpression) QualifiedNameValueConverter(org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter) TypeReferences(org.eclipse.xtext.common.types.util.TypeReferences) Iterables(com.google.common.collect.Iterables) JvmFeature(org.eclipse.xtext.common.types.JvmFeature) FQNImporter(org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider.FQNImporter) AbstractElement(org.eclipse.xtext.AbstractElement) XAbstractFeatureCall(org.eclipse.xtext.xbase.XAbstractFeatureCall) StaticExtensionFeatureDescriptionWithImplicitFirstArgument(org.eclipse.xtext.xbase.scoping.batch.StaticExtensionFeatureDescriptionWithImplicitFirstArgument) IReplacementTextApplier(org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.IReplacementTextApplier) JvmType(org.eclipse.xtext.common.types.JvmType) PrefixMatcher(org.eclipse.xtext.ui.editor.contentassist.PrefixMatcher) NodeModelUtils(org.eclipse.xtext.nodemodel.util.NodeModelUtils) RepeatedContentAssistProcessor(org.eclipse.xtext.ui.editor.contentassist.RepeatedContentAssistProcessor) IDocument(org.eclipse.jface.text.IDocument) Lists(com.google.common.collect.Lists) TypesPackage(org.eclipse.xtext.common.types.TypesPackage) ConfigurableCompletionProposal(org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal) BadLocationException(org.eclipse.jface.text.BadLocationException) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) JvmConstructor(org.eclipse.xtext.common.types.JvmConstructor) EReference(org.eclipse.emf.ecore.EReference) IJavaSearchConstants(org.eclipse.jdt.core.search.IJavaSearchConstants) XtextResource(org.eclipse.xtext.resource.XtextResource) XExpression(org.eclipse.xtext.xbase.XExpression) Assignment(org.eclipse.xtext.Assignment) JvmIdentifiableElement(org.eclipse.xtext.common.types.JvmIdentifiableElement) XAssignment(org.eclipse.xtext.xbase.XAssignment) LightweightTypeReferenceFactory(org.eclipse.xtext.xbase.typesystem.references.LightweightTypeReferenceFactory) IScope(org.eclipse.xtext.scoping.IScope) IExpressionScope(org.eclipse.xtext.xbase.typesystem.IExpressionScope) Maps(com.google.common.collect.Maps) TypeMatchFilters(org.eclipse.xtext.common.types.xtext.ui.TypeMatchFilters) RuleCall(org.eclipse.xtext.RuleCall) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) ReplaceConverter(org.eclipse.xtext.xbase.ui.imports.ReplaceConverter) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription) PreferenceConstants(org.eclipse.jdt.ui.PreferenceConstants) ITypesProposalProvider(org.eclipse.xtext.common.types.xtext.ui.ITypesProposalProvider) ConfigurableCompletionProposal(org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal) IReplacementTextApplier(org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal.IReplacementTextApplier) ICompletionProposal(org.eclipse.jface.text.contentassist.ICompletionProposal) FQNImporter(org.eclipse.xtext.xbase.ui.contentassist.ImportingTypesProposalProvider.FQNImporter) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

Function (com.google.common.base.Function)1 Predicate (com.google.common.base.Predicate)1 FluentIterable (com.google.common.collect.FluentIterable)1 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Inject (com.google.inject.Inject)1 List (java.util.List)1 Map (java.util.Map)1 Logger (org.apache.log4j.Logger)1 EObject (org.eclipse.emf.ecore.EObject)1 EReference (org.eclipse.emf.ecore.EReference)1 IJavaSearchConstants (org.eclipse.jdt.core.search.IJavaSearchConstants)1 PreferenceConstants (org.eclipse.jdt.ui.PreferenceConstants)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 IDocument (org.eclipse.jface.text.IDocument)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 IContextInformation (org.eclipse.jface.text.contentassist.IContextInformation)1 StyledString (org.eclipse.jface.viewers.StyledString)1 AbstractElement (org.eclipse.xtext.AbstractElement)1