Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to interactively waiting for background jobs? [solved](Display the "Waiting for background jobs to complete" dialog)
How to interactively waiting for background jobs? [solved] [message #1258537] Thu, 27 February 2014 13:38 Go to next message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
Hello,

when I have a long-running job and the user does an action which needs this job to complete before, I want to display the "Waiting for background jobs to complete" with the option to cancel the action the user currently wants to do, as it is done in Eclipse e.g. when a lengthy build is in progress and I want to save a file.

How do I achieve this? As I read in the documentation, a simple join() on the job simply blocks the current thread. Unfortunately, I found nothing about that searching the web.

[Updated on: Sat, 01 March 2014 10:48]

Report message to a moderator

Re: How to interactively waiting for background jobs? [message #1260343 is a reply to message #1258537] Sat, 01 March 2014 10:48 Go to previous message
Jens Rabe is currently offline Jens RabeFriend
Messages: 81
Registered: September 2013
Member
I found the answer myself after doing some googling, source-digging and single-stepping. The answer is using scheduling rules. Unfortunately, the documentation and wiki are not that comprehensive on that topic, but here is how I solved it:

For our data model, there is a known set of dependencies which jobs should be put on hold while certain objects are worked on. I transferred this into a set of simple scheduling rules as follows:
Rule 1 contains Rule 2 if either
- both rules are for the same object, or
- Rule 2's object is "reachable" from Rule 1's by traversing the dependency graph from the latter one.

Rule 1 conflicts Rule 2 if either rule contains the other one.

Applying these rules to my jobs yield the desired execution sequence, and using IJobManager.beginRule causes the "Waiting for background jobs to complete" dialog to pop up, and conflicting jobs to be held until I issue IJobManager.endRule.

[Updated on: Sat, 01 March 2014 10:48]

Report message to a moderator

Previous Topic:NoClassDefFoundError for imported package
Next Topic:fragment.e4xmi perspective does not show specified icon
Goto Forum:
  


Current Time: Fri Apr 19 21:13:02 GMT 2024

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

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

Back to the top