Skip to main content



      Home
Home » Modeling » TMF (Xtext) » custom content assist help needed
custom content assist help needed [message #809349] Tue, 28 February 2012 14:32 Go to next message
Eclipse UserFriend
Hi,

The default content assist gives the correct proposals but I would like to change it string output. I have done custom scoping to get a correct visibility so I don't want to reconstruct all loops etc for content assist because it works in fact out of the box now. Is there an easy way to just change the string outputs of the proposals?

@Override
	public void complete_PredicateTerminal(EObject model, RuleCall ruleCall,
			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		// how to easy modify proposal string output from default xtext content assist?
		// using model I need to reconstruct everything so is there no other option?
		super.complete_PredicateTerminal(model, ruleCall, context, acceptor);
	}


Regards,
Phil
Re: custom content assist help needed [message #809353 is a reply to message #809349] Tue, 28 February 2012 14:36 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

what do you mean with "string" output? can you give an example what you exactly want to do.

~Christian
Re: custom content assist help needed [message #809374 is a reply to message #809353] Tue, 28 February 2012 15:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,
like:
acceptor.accept(createCompletionProposal(str_name, str_name,  ns, context));

there the str_name I would like to customize for the default proposals of xtext

Phil
Re: custom content assist help needed [message #809380 is a reply to message #809374] Tue, 28 February 2012 15:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

which kind of default proposals? for terminals? for keywords? for cross refs?
these are all handeled differently. so which is your case?

~Christian
Re: custom content assist help needed [message #809383 is a reply to message #809380] Tue, 28 February 2012 15:21 Go to previous messageGo to next message
Eclipse UserFriend
for cross refs:
PredicateTerminal:
	predicate=[TypePredDeclaration|FQN] ('(' right=TermTuple? ')')?
;


Phil
Re: custom content assist help needed [message #809385 is a reply to message #809383] Tue, 28 February 2012 15:23 Go to previous messageGo to next message
Eclipse UserFriend
hi,

what about overriding DefaultProposalCreator and return the sublass in org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.getProposalFactory(String, ContentAssistContext)

~Christian
Re: custom content assist help needed [message #809395 is a reply to message #809385] Tue, 28 February 2012 15:40 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian, thx DefaultProposalCreator has useful code. So then I'm able to adjust the "apply" method at the line :
result = createCompletionProposal(proposal, displayString, image, contentAssistContext);
, just what I needed.
But how to return the subclass if I can't modify AbstractJavaBasedContentProposalProvider or should I also override it?
Will it not affect other content proposals? I need it for a couple of cross reference proposals but not all of them

Regards,
Phil

[Updated on: Tue, 28 February 2012 15:48] by Moderator

Re: custom content assist help needed [message #809398 is a reply to message #809395] Tue, 28 February 2012 15:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

your proposal provider already extends AbstractJavaBasedContentProposalProvider
Re: custom content assist help needed [message #809401 is a reply to message #809398] Tue, 28 February 2012 15:53 Go to previous message
Eclipse UserFriend
Ok, thank you. I have enough information I think to get it to work.

Thank you christian for your help !

Phil
Previous Topic:Fornax mwe2 problem
Next Topic:Terminal Rule Bug?
Goto Forum:
  


Current Time: Wed Jul 02 20:25:14 EDT 2025

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

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

Back to the top