Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to close progress bar only after all asyncExecs?
How to close progress bar only after all asyncExecs? [message #800347] Fri, 17 February 2012 00:47 Go to next message
Josh Hester is currently offline Josh HesterFriend
Messages: 30
Registered: July 2009
Member
I've implemented an swt progress bar, and it's working fine. The problem came when I inserted a statement to dispose of my display when I get a progress complete event.

If the progress happens very rapidly, the complete message comes before all of the progress events have been displayed, leading to the progress bar showing up very quickly and then disappearing before it shows 100%.

What I'd like to do is wait a few seconds after the complete message has been received before disposing of the display. For whatever reason I either can't get it to wait before disposing, or I get a Threading exception when I try to operate on the display.

Is there a standard way to do this? Any advice would be helpful.

Thanks,

-Josh
Re: How to close progress bar only after all asyncExecs? [message #805527 is a reply to message #800347] Thu, 23 February 2012 21:38 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
To do something after a delay has passed you can invoke
Display.timerExec() on the main thread. For an example of this see
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet60.java
..

Grant


On 2/16/2012 7:47 PM, Josh Hester wrote:
> I've implemented an swt progress bar, and it's working fine. The problem
> came when I inserted a statement to dispose of my display when I get a
> progress complete event.
>
> If the progress happens very rapidly, the complete message comes before
> all of the progress events have been displayed, leading to the progress
> bar showing up very quickly and then disappearing before it shows 100%.
>
> What I'd like to do is wait a few seconds after the complete message has
> been received before disposing of the display. For whatever reason I
> either can't get it to wait before disposing, or I get a Threading
> exception when I try to operate on the display.
>
> Is there a standard way to do this? Any advice would be helpful.
>
> Thanks,
>
> -Josh
Previous Topic:Setting XULRunner properties programmatically
Next Topic:Glib error when disposing a Combo under Linux
Goto Forum:
  


Current Time: Sat Dec 20 01:43:09 GMT 2014

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

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