|
|
|
Re: Order if content assist items [message #895308 is a reply to message #895299] |
Thu, 12 July 2012 12:24 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Michel,
did you try to return a relevance that is higher than the relevance of
the other proposals, eg. 10k ?
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 12.07.12 14:00, schrieb Michel Simeon:
> Thanks for the comment, but I am not sure what to do with it.
> I looked into
> org.eclipse.xtext.ui.editor.templates.DefaultTemplateProposalProvider.getRelevance(Template)
>
> and what I found is:
>
> public int getRelevance(Template template) {
> return 90;
> }
>
> I guess I could overwrite this method in order to change the relative
> order of templates, but my problem is different: pressing Ctrl-Space
> produces a list of proposals that in my case would generally include a
> mix of IDs, keywords and template names. By naming all my templates
> starting with - (e.g. -Script), they are automatically grouped together,
> and in the CA list of the previous version of my DSL they used to come
> on top of the list, which is what I wanted. In other words, -Axx or -Zxx
> came before Axx.
>
> But now the group comes at the bottom, and i do not know how to change
> the overall sorting order of the content-assist list.
> Any other suggestions would be most welcome.
> MS
|
|
|
|
|
Re: Order of content assist items [message #895427 is a reply to message #895382] |
Thu, 12 July 2012 20:57 |
Michel Simeon Messages: 130 Registered: December 2009 |
Senior Member |
|
|
Thanks again.
It does work indeed, now all the templates come on top of the CA proposals list. For those interested, this is what I did, based on the suggestions I received:
My language being called Mads, I defined:
public class MadsTemplateProposalProvider extends DefaultTemplateProposalProvider{
@Inject
public MadsTemplateProposalProvider(TemplateStore templateStore,
ContextTypeRegistry registry, ContextTypeIdHelper helper) {
super(templateStore, registry, helper);
}
@Override
public int getRelevance(Template template){
return 10000;
}
}
and then I added the following to my MadsUiModule :
public Class<? extends DefaultTemplateProposalProvider>
bindDefaultTemplateProposalProvider(){
return MadsTemplateProposalProvider.class;
}
MS
P.S. Even if that works, I still would like to understand why things have changed
when moving from Indigo to Juno !!!
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05534 seconds