Bug 294242 - [FieldAssist] ContentProposalAdapter with autoActivationDelay pops up too early with long delay and fast input [with patch]
Summary: [FieldAssist] ContentProposalAdapter with autoActivationDelay pops up too ear...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-04 14:24 EST by Hannes Erven CLA
Modified: 2019-09-06 15:30 EDT (History)
0 users

See Also:


Attachments
Patch (perhaps more a hack? not sure if its good) (370 bytes, patch)
2009-11-04 14:29 EST, Hannes Erven CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hannes Erven CLA 2009-11-04 14:24:27 EST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14
Build Identifier: 20090920-1017

Use case: present the user with a field assist to input some data. The fetch of the proposals from the database is rather expensive (~0.5 sec) so we set a moderate autoActivationDelay of 500 msec.
When typing quickly, the popup opens 500 msec after the FIRST key type, not after the LAST one. The proposals are then calculated for every additional key (as the proposal popup now is open), which slows user input unnecessarily down.

My analysis is: The ContentProposalAdapter.autoActivate() method starts off a new Thread that sleeps for the specified autoActivationDelay, checks for intermittent key strokes and then opens the popup. It does this for any key stroke so there may be more than one such thread running/sleeping at a time.
The problem is with the flag receivedKeyDown, that is set to false by the event handling thread after autoActivationDelay and to true by the key handler.
If the delay is long enough that the user manages to fire more than one additional key events during the sleep phase of such a thread, the first key's open popup thread will clear the receivedKeyDown flag and hence the second key's open popup thread will open the popup, regardless of the events that might have followed.

Reproducible: Always
Comment 1 Hannes Erven CLA 2009-11-04 14:25:40 EST
My suggested fix would be to have the autoPopup() method make sure that any sleeping thread will not open the pop up before spawning a new popup thread. I'll attach the patch shortly.
Comment 2 Hannes Erven CLA 2009-11-04 14:29:52 EST
Created attachment 151349 [details]
Patch (perhaps more a hack? not sure if its good)

Patch against org.eclipse.jface/src/org/eclipse/jface/fieldassist/ContentProposalAdapter.java # 1.71

I'm not sure if this is a bullet-proof way to fix the issue.
Comment 3 Eclipse Webmaster CLA 2019-09-06 15:30:05 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.