Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Filter the terminals list proposed in content assistant
Filter the terminals list proposed in content assistant [message #1831232] Fri, 14 August 2020 13:06 Go to next message
Georgiana Ecobici is currently offline Georgiana EcobiciFriend
Messages: 23
Registered: July 2019
Junior Member
When a grammar is more permisive, it is possible to filter the terminals proposed in content assistant?

In the grammar below, need to show in Content Assist only Component or only Function depending on my context.

Model:
'scenario' begin = '{' participants+=Participant*
end = '}';
Participant:
Component | Function
;
Component:
'component' name=STRING (nature = ('unset' | 'behavior' | 'node'))?
;
Function:
'function' name=STRING 'as' id=ID
;

Tried to override the complete_ methods in AbstractDslProposalProvider (Dsl-the name of the grammar file), but it still proposes all the terminals (keywords supported).

override void completeModel_Participants(EObject model, Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
acceptor.accept(createCompletionProposal("test1", "test1", null, context));
}

override complete_Participant(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
acceptor.accept(createCompletionProposal("test2", "test2", null, context));
}

override void complete_Component(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
// subclasses may override
acceptor.accept(createCompletionProposal("test3", "test3", null, context));
}
Re: Filter the terminals list proposed in content assistant [message #1831233 is a reply to message #1831232] Fri, 14 August 2020 13:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
For keywords you have to override completeKeyword

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Filter the terminals list proposed in content assistant [message #1831234 is a reply to message #1831233] Fri, 14 August 2020 13:26 Go to previous messageGo to next message
Georgiana Ecobici is currently offline Georgiana EcobiciFriend
Messages: 23
Registered: July 2019
Junior Member
I'll try:

AbstractJavaBasedContentProposalProvider::completeKeyword.

[Updated on: Fri, 14 August 2020 13:28]

Report message to a moderator

Re: Filter the terminals list proposed in content assistant [message #1831235 is a reply to message #1831234] Fri, 14 August 2020 13:37 Go to previous message
Georgiana Ecobici is currently offline Georgiana EcobiciFriend
Messages: 23
Registered: July 2019
Junior Member
Thanks, it works by overriding completeKeyword.
Previous Topic:Xtend Maven issues after upgrading to Java 9
Next Topic:How to programmtically add EObject into Resource
Goto Forum:
  


Current Time: Fri Oct 23 01:10:36 GMT 2020

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

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

Back to the top