Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Get a List<String> in something.mydsl(XTEXT- grammar)  () 1 Vote
icon5.gif   Get a List<String> in something.mydsl [message #691823] Sat, 02 July 2011 13:11 Go to next message
Caner Friend
Messages: 98
Registered: July 2011
Member
Hi, Thank you so much for magnificently useful tool.

However, I had some problems;

For example, I have a List<String>writers , which contains 10000 writer's names, for instance one of them is "Stefan King" .
I dont want to define all of them by one by, because i have ten more existing lists like this. Is there any way to get a list into my grammar?

Because While I am coding with my dsl in my
" something.mydsl " file. I want that content assist completes "Stefan King" or comes up with some proposal names, which start with "Ste", , while I typed "Ste"

How can I solve this?

Or is there any other way than this, how can i monitor List elements in a content assist displayer ,
such as when I type "Ste" for "Stefan King" in "something.mydsl"

Thanks a lot

[Updated on: Sat, 02 July 2011 18:55]

Report message to a moderator

Re: Get a List<String> in something.mydsl [message #692061 is a reply to message #691823] Sun, 03 July 2011 11:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

since you did not post the grammar it's hard to understand what the problem really is. e.g. having a grammar

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=Name '!';
	
Name hidden(): ID (WS ID)* ;	


you can simply customize content assist

public class MyDslProposalProvider extends AbstractMyDslProposalProvider {
	
	....
	
	@Override
	public void completeGreeting_Name(EObject model, Assignment assignment,
			ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		for (String writer : writers) {
			acceptor.accept(createCompletionProposal(writer, context));
		}
	}

}


the prefix matching works out of the box.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 03 July 2011 11:22]

Report message to a moderator

Re: Get a List<String> in something.mydsl [message #692085 is a reply to message #692061] Sun, 03 July 2011 14:00 Go to previous message
Caner Friend
Messages: 98
Registered: July 2011
Member
Thank you so much , this is exactly what i was asking Smile
Previous Topic:Beginner problems with simple grammar using the eclipse plugin
Next Topic:Slot 'models' is empty
Goto Forum:
  


Current Time: Fri Apr 26 10:38:09 GMT 2024

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

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

Back to the top