Community
Participate
Working Groups
We should consider a function interface abstraction for Job so that jobs can be created using lambda syntax. For example: public interface IJobRunnable { public IStatus run(IProgressMonitor monitor); } To enable something like this: IJobRunnable runnable = (monitor) -> doSomeWork(monitor); Job myJob = Job.create("Do stuff", runnable); myJob.schedule(); Or simply: Job.create("Do stuff", (monitor) -> doSomeWork(monitor)).schedule();
Note that package org.eclipse.ui.progress has an IJobRunnable with the exact function interface shape we need, but in the wrong plugin. That interface could be made to extend a new interface in Job API and pull the single method declaration up.
I'm sure we could do more here, but I have added the most basic support as described above. http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/?id=40047ddced8f05823560052ecac183626b942a64
I think the new create method should be static. Otherwise, we would need to have at least one job created the old way to be able to create jobs the new way. Also, it could be misleading that we create a job from another job as it may look like a sub-job.
Good catch, it was supposed to be static.
Take two: http://git.eclipse.org/c/platform/eclipse.platform.runtime.git/commit/?id=1b0c291e09ce7c3220169085bbeecad8dd73e358