Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Executing background tasks(Use javafx.concurrent.Servce or jface.operation.IRunnableWithProgress)
Executing background tasks [message #1772702] Thu, 14 September 2017 07:01 Go to next message
Alexander Kerner is currently offline Alexander KernerFriend
Messages: 25
Registered: January 2015
Junior Member
Hi,

what is the recommended way to do some tasks in the background? Do it the 'SWT way'
final ProgressMonitorDialog monitor = new ProgressMonitorDialog(UtilSWT.getShell());
monitor.run(true, true, runnable);

Or the FX way?
new javafx.concurrent.Service(){[..]}.start()


Probably both should work? Are there any pitfalls I should be aware of?

E.g., does it make a difference if the Service/ ProgressMonitorDialog will update an FX component or an SWT component once done?
Re: Executing background tasks [message #1772761 is a reply to message #1772702] Thu, 14 September 2017 21:43 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
1. First of all I think you are embedding JavaFX into an SWT-UI, right? I would stick with the SWT/Platform way.
2. You can call JavaFX from the SWT-Display-Thread and SWT from the JavaFX-Event-Thread because they are the same!
Re: Executing background tasks [message #1772765 is a reply to message #1772761] Thu, 14 September 2017 22:10 Go to previous messageGo to next message
Alexander Kerner is currently offline Alexander KernerFriend
Messages: 25
Registered: January 2015
Junior Member
Yes, embedded FX UI..
I thought, since I am anyways working mainly with FX UI elements, I could be more consequent and do this kind of stuff the FX way as well. I will give it a try, thanks a lot!
Re: Executing background tasks [message #1772778 is a reply to message #1772765] Fri, 15 September 2017 07:02 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
well let me put it this way: You should not directly reference this stuff in FX but eg hide it behind a Service-API so that you don't introduce SWT-Dependencies into your own code.
Previous Topic:java.lang.NoClassDefFoundError only on Mac OS
Next Topic:Headless testing with FX-Test
Goto Forum:
  


Current Time: Sat Dec 14 09:23:19 GMT 2024

Powered by FUDForum. Page generated in 0.03363 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top