Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext 2.4.2: content assist: how to use a filter in completeRuleCall ?(There is no filter in calling completeRuleCall())
Xtext 2.4.2: content assist: how to use a filter in completeRuleCall ? [message #1075135] Sun, 28 July 2013 21:16 Go to next message
J A is currently offline J AFriend
Messages: 31
Registered: July 2013
Member
Dear all,

For content assist, I can use a filter to help accepting/refusing some AST's element if that's a lookupCrossReference, but I cannot do the same thing with completeRuleCall.

Example:
public class MyModelProposalProvider extends AbstractFinancialProposalProvider

        // I could filter the cross-referencings that I don't like
	public void completeProductionReturnType1_FeatureName1(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
                		Predicate<IEObjectDescription> booleanFilter = new Predicate<IEObjectDescription>()
		{
			public boolean apply(IEObjectDescription ieod)
			{
				// Return true/false basing on your liking here
                        }
		};

		lookupCrossReference(((CrossReference)assignment.getTerminal()), context, acceptor, booleanFilter);
	}

        // But I cannot do anything to the completeRuleCall()
        public void completeProductionReturnType2_FeatureName2(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		completeRuleCall(((RuleCall)assignment.getTerminal()), context, acceptor);
	}
}


Do you suggest how I could do manipulate the call to completeRuleCall(), can I manipulate its "context" or "acceptor" ???

[Updated on: Sun, 28 July 2013 21:18]

Report message to a moderator

Re: Xtext 2.4.2: content assist: how to use a filter in completeRuleCall ? [message #1075254 is a reply to message #1075135] Mon, 29 July 2013 06:00 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1189
Registered: July 2009
Senior Member
Hi,

why don't you inspect context, model etc. and delegate to "super" only if a proposal is to be created. You can also create all of the proposals yourself and not use the default implementation at all.

Alex
Re: Xtext 2.4.2: content assist: how to use a filter in completeRuleCall ? [message #1075438 is a reply to message #1075254] Mon, 29 July 2013 12:36 Go to previous message
J A is currently offline J AFriend
Messages: 31
Registered: July 2013
Member
I would look into it, thanks Alexander
Previous Topic:Outline broken in Xtext 2.4.2
Next Topic:Is Xtext generation gap support a myth?
Goto Forum:
  


Current Time: Tue Aug 30 03:19:35 GMT 2016

Powered by FUDForum. Page generated in 0.03735 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software