Bug 564537 - Allow to define a delay for BusyIndicator to show the busy cursor
Summary: Allow to define a delay for BusyIndicator to show the busy cursor
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.14   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2020-06-22 09:11 EDT by Lars Vogel CLA
Modified: 2020-06-26 11:34 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2020-06-22 09:11:17 EDT
BusyIndicator immediately shows the busy cursor, before executing the tasks. Would be nice if we could define a delay in ms which would be used to wait before showing the busy cursor.

This way, we could avoid cursor "jumps" for fast executing tasks.
Comment 1 Lars Vogel CLA 2020-06-22 09:18:48 EDT
Paul, WDYT?
Comment 2 Soraphol (Paul) Damrongpiriyapong CLA 2020-06-25 15:18:18 EDT
Looking at how the busy indicator is implemented, I think it's kind of hard to estimate a delay on it to reduce flashing for fast tasks. The only way we would know if the task is fast is if we run it once & measure.

My suggestion would be to have a minimum time the busy indicator would last for (eg, 1 second) even if the task is fast, the flashing is gone.
Comment 3 Lars Vogel CLA 2020-06-25 15:23:42 EDT
I think a good value before changing the cursor would be around 200ms
Comment 4 Soraphol (Paul) Damrongpiriyapong CLA 2020-06-25 15:55:07 EDT
Are we talking about going from normal to busy, or busy back to normal?

I think we can't put a delay before for normal to busy, because even if we wait 200ms, what if the runnable is finished at 201ms, the flashing will still appear. Correct me if I'm wrong here, I might just be confused.
Comment 5 Lars Vogel CLA 2020-06-25 18:20:07 EDT
(In reply to Soraphol (Paul) Damrongpiriyapong from comment #4)
> Are we talking about going from normal to busy, or busy back to normal?
> 
> I think we can't put a delay before for normal to busy, because even if we
> wait 200ms, what if the runnable is finished at 201ms, the flashing will
> still appear. Correct me if I'm wrong here, I might just be confused.

I think it might reduce the flashing. 

Lets say a perspective switch takes normally 120 ms. At the moment the cursor flashes always during switch. If we could allow a default delay or a delay which can be set during the call of BusyIndicator, most perspective switch operations would not change the cursor only if a switch takes longer the cursor would change. A duration of a little more than > 200 would still flash but I think it would be better than currently as currently it always flashes.
Comment 6 Soraphol (Paul) Damrongpiriyapong CLA 2020-06-26 11:34:22 EDT
I have tried to implementing this, but putting a delay on the setting the busy cursor but the problem is that we don't have access to the status of the runnable. 

With the current setup, there is no way for some sort of signal/callback structure that can be used to setup a signal for when the thread has passed a certain point to switch to the busy cursor. 

I have tried a TimerTask but the problem is that the it is running on a different thread & causes a SWTException.