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: 14665
Registered: July 2009
Senior Member
For keywords you have to override completeKeyword

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:Standalone XBase DSl with Compile Time Java Source (.java) and Jar (.class file) Dependencies
Next Topic:How to programmtically add EObject into Resource
Goto Forum:
  


Current Time: Fri Apr 19 21:07:59 GMT 2024

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

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

Back to the top