Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Content-Assist for elements in a list(How to implement the complete_XXX function for the ProposalProvider for elements in a list)
Content-Assist for elements in a list [message #1020669] Mon, 18 March 2013 13:23
Eclipse UserFriend
Hi,

I'm trying to implement a ProposalProvider for a grammar which contains a list of elements (my actual problem is a bit more complicated so I tried to bring it down to a small example).
My grammer looks like:

Model:
  values+=DataEntry+
;

DataEntry:
  "(" attrs += DataAttrStringValue ("," attrs += DataAttrStringValue)* ")" 
;
 
DataAttrStringValue:
  value=STRING
;

So a valid input would be:
("France", "Paris")
("Germany", "Berlin")

I would like to implement now a ProposalProvider which offers different proposals depending on the position in the list (e.g. in the example, if the user is in the first column, I would like to offer a list of country names, and in the second column a list of city names). Therefor I tried
public void completeDataAttrStringValue_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
   System.out.println("completeDataAttrStringValue_Value with model " + model);
}

but the passed model object is not a DataAttrStringValue but a DataEntry, making it impossible for me to get the current position in the DataEntry.
Is there any way to achieve this with the ProposalProvider? At the moment I'm really stuck and would really appreciate any help.

Best regards
Florian
Previous Topic:[Xtend2]
Next Topic:How to support user customization of a code generators Xtend2-based templates?
Goto Forum:
  


Current Time: Tue Jul 01 07:37:22 EDT 2025

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

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

Back to the top