Can not get activation character in IContentProposalProvider [message #1578361] |
Thu, 22 January 2015 05:50  |
Eclipse User |
|
|
|
I wanted to make a small demo for ContentProposal feature using RAP (2.3.1). I have got a word list of English language and I wanted to provide content proposals as soon as the user enters two characters. So I simply added all digits and letters as activation characters into the ContentProposalAdapter.
I have got a problem however. IContentProposalProvider gets theoretically the content of the associated Text field into its getProposals method. Still the activation character itself is not in the string. So for example:
- I enter "a" into the empty field -> I get an empty string as content, but position is 0
- I add "b" to the text field (so "ab") so far -> I get "a" as content and 1 as position.
The activation character itself is not at the end of the content string as I would expect. After some debugging the problem seems to be that no matter that the autoactivate uses asynchronous popup opening in autoActivate method, still opening the popup and asking for proposals from the provider happens always before updating the text of the TextField. So org.eclipse.jface.fieldassist.ContentProposalAdapter.getProposals() in line 2139 will always deliver the "getText()" of the text, which does not contain the activation character:
String contents = getControlContentAdapter().getControlContents( getControl());
Since org.eclipse.jface.fieldassist.TextContentAdapter.getControlContents(Control) contains:
public String getControlContents(Control control) {
return ((Text) control).getText();
}
What do I wrong? Do I misuse something, or this is a bug? I would expect to get that activation character in contents string in IContentProposalProvider.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03516 seconds