I am using org.eclipse.jface.fieldassist.AutoCompleteField class to suggest my combo box options. But it’s not useful, because it only suggests entries matching entered text at the beginning.
JavaCode:
ComboContentAdapter comboAdapter = new ComboContentAdapter();
new AutoCompleteField(branchCombo,comboAdapter,branchCombo.getItems());
Example :
Combo Box Options:
['ZMEDIA_TWITTER_MIGRATION_BRANCH','ZMEDIA_TWITTER_HOTFIX_BRANCH','ZMEDIA_FB_BRANCH'].
If I type TWITTER in combo box it suggests nothing . It looks like the TWITTER with startswith match in combobox options .
Is there any option to override this?
Thanks You
Simply put, there isn’t.
However, this can be achieved by creating your own proposal provider by implementing
org.eclipse.jface.fieldassist.IContentProposalProviderand implementing your filtering logic in its’getProposals(String contents, int position)method.Then, just add your proposal provider to a
ContentProposalAdapterand adapt the combobox, as follows: