Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Filter Java types in content assist
Filter Java types in content assist [message #1068003] Thu, 11 July 2013 15:44 Go to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 81
Registered: July 2009
Member
Hi,

how can I filter Java types in the content assist in a Xtext generated DSL?

I have a rule with an attribute which refers to a JvmTypeReference.

I want to filter the content assist so that only types are shown which implement a specific interface.

How should I do that? Is the MyDslProposalProvider the correct place and how to filter the types there?

With regards,
Udo
Re: Filter Java types in content assist [message #1068009 is a reply to message #1068003] Thu, 11 July 2013 16:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

how does your grammar look like?
yes the MyDslProposalProvider is a good place (you may have to write a validation rule as well)

you may have a look at org.eclipse.xtext.xbase.ui.contentassist.XbaseProposalProvider.completeJavaTypes(ContentAssistContext, EReference, ICompletionProposalAcceptor)
and follow ups.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Filter Java types in content assist [message #1068016 is a reply to message #1068009] Thu, 11 July 2013 17:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.S: may this is still working

http://kthoms.wordpress.com/2012/03/14/how-to-limit-proposed-java-types-to-implementors-of-an-interface/


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Filter Java types in content assist [message #1068102 is a reply to message #1068016] Fri, 12 July 2013 07:56 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 81
Registered: July 2009
Member
Thanks for the blog you mentioned. It is a good starting point.

Now I fight with the missing documentation of the methods in XbaseProposalProvider and how everything is linked together. Sad

Re: Filter Java types in content assist [message #1068117 is a reply to message #1068102] Fri, 12 July 2013 09:39 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 81
Registered: July 2009
Member
I got everything working as I wanted and the proposal dialog shows me only the classes I want to see.

But now I have the problem that when I press ENTER on a proposal the class name is not inserted in the DSL file anymore. What is the problem?
Re: Filter Java types in content assist [message #1068121 is a reply to message #1068117] Fri, 12 July 2013 09:41 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry without any more specific information i cannot help

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Post-processing the generated genmodel?
Next Topic:XAnnotations in 2.4
Goto Forum:
  


Current Time: Tue Apr 16 19:20:57 GMT 2024

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

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

Back to the top