Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsLinkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067604/#msg_1067604
can anyone tell me how the scope and the ScopeProvider is linked with the contentassistant and the ProposalProvider?
Or are they linked at all?
I want to know it because in my DSL I have some cases where I have to limit the
available proposals of the contentassistant.
For example:
I have C like if-statements in my DSL in which conditions I can make references to
formulate this conditions. This works perfect and the contentassistant shows all
available objects. But in some cases for example if the if-statement is in a "Template" object I want to limit the available proposals to object which are in the same
"template" object.
So how can I change this behaviour? Do I have to write a ScopingProvider or a
ProposalProvider?
I hope was able to make my problem clear so that you can give me some advices. ]]>Sascha Gstir2013-07-09T14:33:33-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067614/#msg_1067614
the ProprosalProvider calls (with some indirections)
org.eclipse.xtext.ui.editor.contentassist.AbstractJavaBasedContentProposalProvider.lookupCrossReference(EObject, EReference, ICompletionProposalAcceptor, Predicate<IEObjectDescription>, Function<IEObjectDescription, ICompletionProposal>)
So you can actually pass in a predicate to filter stuff.
]]>Christian Dietrich2013-07-09T14:56:01-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067623/#msg_1067623
I did originally have an xbase scope provider so it worked ok, but when I moved to 2.4 I changed it because it is deprecated. Now the scoping works again but I can't see how to change the abstract 'mydsl' proposal provider because it is a generated class.
Is it something in the runtime/mwe modules that determines what the super class of the generated proposal provider is?]]>Ian McDevitt2013-07-09T16:21:41-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067683/#msg_1067683
Do you maybe have a short example for me how such a predicate or ProposalProvider has to look like?]]>Sascha Gstir2013-07-10T06:16:41-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067684/#msg_1067684
superclass of your MyDslProposalProvider
--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de]]>Christian Dietrich2013-07-10T06:23:44-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067708/#msg_1067708
You can always have a class extending a DeclarativeScopeProvider and delegate to it in the ScopeProvider extending XbaseScopeProvider for your grammar elements while calling super.getScope for the rest of the grammar.
Then, to filter VALID elements you have two choices:
either using only scopes
either using proposal filtering + validation
It will depends on the particular thing that you want to filter I think.]]>Victor Noël2013-07-10T08:54:43-00:00Re: Linkage between scope and contentassistant??
https://www.eclipse.org/forums/index.php/mv/msg/490120/1067740/#msg_1067740
Thanks
Ian]]>Ian McDevitt2013-07-10T11:49:10-00:00