| Summary: | Content Proposal only activated by the second key stroke | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Moritz Post <mpost> | ||||
| Component: | JFace | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | tbuschto | ||||
| Version: | 1.4 | ||||||
| Target Milestone: | 1.5 M5 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Bug Depends on: | |||||||
| Bug Blocks: | 330461 | ||||||
| Attachments: |
|
||||||
|
Description
Moritz Post
Created attachment 189272 [details]
Entry point to reproduce it
The actual problem is the wrong (different from RCP) value of "position" parameter of IContentProposalProvider#getProposals method. When you type the first character, the "position" parameter is 1 in RCP, but 0 in RAP. The attached snippet returns empty array with proposals if "position" is 0. ContentProposalAdapter is heavy use Key Events. The proposals shell is auto activated on KeyDown event if autoActivationCharacters are set or on Modify Event if they are not set. Because key events are fired before setting the text caret position we get wrong (previous) caret position. For now, the workaround is to *NOT* set the autoActivationCharacters. Fixed in CVS HEAD. The more general underlying problem was that key events are send before they are processed by the client, so widgets influenced by the key event dont have a chance to update. Fixed by sending the request asynchronously (i.e. with a timeout of 0 ms). My reasearch showed that even if the timer is started on keydown, it wont trigger until after the following keypress event. |