Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » custom content assist help needed
custom content assist help needed [message #809349] Tue, 28 February 2012 19:32 Go to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
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 19:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

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

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: custom content assist help needed [message #809374 is a reply to message #809353] Tue, 28 February 2012 20:08 Go to previous messageGo to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
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 20:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

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

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: custom content assist help needed [message #809383 is a reply to message #809380] Tue, 28 February 2012 20:21 Go to previous messageGo to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
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 20:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
hi,

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

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: custom content assist help needed [message #809395 is a reply to message #809385] Tue, 28 February 2012 20:40 Go to previous messageGo to next message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
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 20:48]

Report message to a moderator

Re: custom content assist help needed [message #809398 is a reply to message #809395] Tue, 28 February 2012 20:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

your proposal provider already extends AbstractJavaBasedContentProposalProvider


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: custom content assist help needed [message #809401 is a reply to message #809398] Tue, 28 February 2012 20:53 Go to previous message
Phil R is currently offline Phil RFriend
Messages: 99
Registered: September 2011
Member
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: Thu Mar 28 18:54:22 GMT 2024

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

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

Back to the top