My e4 app is a client-server app, so there are several operations that you wouldn't really call long-running, but which take long enough that it would be nice to give feedback to the user that something is happening. For example, opening an editor means downloading the contents from the server, which will take 1 or 2 seconds. Generally speaking, anything that takes longer than a second should give some feedback.

Is there an e(fx)clipse equivalent of SWT's BusyIndicator.showWhile()? Doing the equivalent in JavaFX is somewhat complicated, involving a combination of Tasks and Platform.runLater(), so I was hoping someone had already done the work

e(fx)clipse has no such thing in its library and I'm not aware of
another JavaFX library who has such a feature.

I would probably target it a bit differently anyways and instead open
the editor immediately and showing the load progress / wait info inside
the editor area but anyways:

In general I understand the need for such a feature and think
e(fx)clipse should provide a service-API one can use. Feel free to file
a bug and maybe contribute an implementation.

BTW - I'm more a fan of JDKs concurrent-APIs when we talk about
asynchronous programming!

Tom

On 27.04.16 23:11, Colin Sharples wrote:
> My e4 app is a client-server app, so there are several operations that
> you wouldn't really call long-running, but which take long enough that
> it would be nice to give feedback to the user that something is
> happening. For example, opening an editor means downloading the contents
> from the server, which will take 1 or 2 seconds. Generally speaking,
> anything that takes longer than a second should give some feedback.
>
> Is there an e(fx)clipse equivalent of SWT's BusyIndicator.showWhile()?
> Doing the equivalent in JavaFX is somewhat complicated, involving a
> combination of Tasks and Platform.runLater(), so I was hoping someone
> had already done the work :)

Thanks, Tom. Given that there is an Eclipse/SWT version, I thought it would be nice to support something similar in e(fx)clipse. I have tweaked it a bit, as I realized it wasn't quite doing what I wanted. To be clear, the point about this is to provide the ability to manage short long-running tasks, so while it is using a Task to invoke the action, it's really about providing feedback during an action that would normally just be invoked on the FX app thread. So the tweaks I made are: moved the set WAIT cursor out of the task, so that will happen immediately on the return from showWhile(), and invoked the runnable on the FX application thread using Platform.runLater(), so that any work you perform can do UI work directly without invoking Platform.runLater(). The sweet spot for using this is for user actions that will take between 1 and 3 seconds to run - anything shorter than a second doesn't really need to provide feedback, anything longer than 2-3 seconds should probably stronger feedback such as a progress bar, and use a genuine background task to do the work (for which the JavaFX concurrent support is enough). I'll raise a bug for this.