Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » ModalContext.setAllowReadAndDispatch does not work correct as comment
ModalContext.setAllowReadAndDispatch does not work correct as comment [message #1805769] Tue, 23 April 2019 12:04 Go to next message
Daryl Qiu is currently offline Daryl QiuFriend
Messages: 2
Registered: April 2019
Junior Member
Hello everyone,

Currentlly, I am executing a job in the UI thread that takes a long time, but I don't what it to hand the UI.
So I use the ModalComtext.run(...) method to put the job into a non-UI thread, then I can click on the UI interface during the execution of this job.But I got exections that the widget is disposed.
I found out that this is because display.readAndDispatch is called in the method ModalComtextThread.block() to respond to the UI event. Then I use ModalContext.setAllowReadAndDispatch(false) first.
But the strange thing is that the job is now running in the UI thread, it will hang up the UI, this is not the result I expected. What should I do?

Best Regards

[Updated on: Wed, 24 April 2019 05:25]

Report message to a moderator

Re: ModalContext.setAllowReadAndDispatch does not work correct as comment [message #1805806 is a reply to message #1805769] Wed, 24 April 2019 12:51 Go to previous messageGo to next message
Eclipse UserFriend
If you want to keep the UI responsive but is otherwise locked, such that it refreshes but doesn't accept interaction, then look at the Workbench's IProgressService. Alternatively you can use IWorkbenchWindow#run().
Re: ModalContext.setAllowReadAndDispatch does not work correct as comment [message #1805827 is a reply to message #1805806] Thu, 25 April 2019 03:33 Go to previous message
Daryl Qiu is currently offline Daryl QiuFriend
Messages: 2
Registered: April 2019
Junior Member
Hello Brian,

Many thanks for your suggestion. Both methods are effective for my case.
The difference I see is that if I select change 3 times, Workbench's IProgressService will respond to all job one by one, but IWorkbenchWindow#run() only responds to the first and last ones, and the second has been canceled. Right?

Best Regards,

[Updated on: Thu, 25 April 2019 07:47]

Report message to a moderator

Previous Topic:Best way to make data-binding conditional
Next Topic:NPE in ColumnViewerEditor due to cellEditor is null
Goto Forum:
  


Current Time: Thu Apr 18 23:49:38 GMT 2024

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

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

Back to the top