Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Periodic job with UI interaction on eclipse plugin
Periodic job with UI interaction on eclipse plugin [message #987811] Wed, 28 November 2012 09:19 Go to next message
Elton Mathias is currently offline Elton MathiasFriend
Messages: 2
Registered: November 2012
Junior Member
I'm developing an eclipse plugin and I'd like to have a background job that, under certain conditions, pops up a shell. The problem is that:

- asyncExec runs on the UI thread, so I can't do a while(true) ... Thread.sleep(). Same thing for UIJob
- a separate Thread (let's say a Runable, scheduled via ScheduledExecutorService.scheduleatFixedRate) solve the problem of running the job in the background, but then I have no access to the UI thread to reuse the display.
- I also tried to create a new Display ... I've got no errors, but the shell does not shows up.
Trying to reuse the display with Display.getDefault() or Display.getCurrent() hangs while creating Shell and Display.getDefault().getActiveShell() also hangs.

So, what should I do instead ?

Any help is more than welcome!
Re: Periodic job with UI interaction on eclipse plugin [message #988337 is a reply to message #987811] Thu, 29 November 2012 13:18 Go to previous message
Eclipse UserFriend
Never create your own Display unless know otherwise!

Use a background thread to do your work and use Display.syncExec() with your current display to do your UI operations as required. If you're building on top of the Eclipse Platform, and not just on SWT, the Jobs API is a great way -- just subclass from the Job class rather than the UIJob class.

Brian,
Previous Topic:Which Layout for this question.
Next Topic:Strike through Font?? is this possible in SWT
Goto Forum:
  


Current Time: Fri Apr 26 04:11:42 GMT 2024

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

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

Back to the top