Hi Sascha, asynchExec does not fork a thread to do work, but it ensures that work that is invoked from a background thread gets performed in the main UI thread. A good example is linked below. It forks a Thread to populate a Table; this forked thread then syncExec's all operations performed on the Table, since SWT widgets can only be used in the main thread. Add a Thread.sleep(1000) line right after the "for" line and you'll see that the UI stays responsive while the table is populating. http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/snippits/snippet7.html Grant Sascha wrote: > Dave Wegener wrote: > > Sascha wrote: > > > Hi! > > > I have a long running process starting from the GUI. If I only start the > > > process, the GUI is not working until the process stops. So I decided to > > > make the process implementing Runnable and start the process out of the > > > GUI via Display.getCurrent().asyncExec(MyProcess). But there is no new > > > thread generated for this method. When I make my process a subclass of > > > Thread, I always get a "org.eclipse.swt.SWTError : Invalid thread access". > > > I've tried to write a little process which returns a message every second. > > > The same happens: I cannot use the GUI until the process stop because it > > > is running in thread main. > > > Can somebody help me? > > > I'm using Eclipse 2.0.2. > > > Thanks > > You are on the right track, you are just calling the asyncExec method with > > the wrong runnable. The purpose of this method is to provide a way for a > > multi-threaded application to update the GUI. The runnable that you pass > > to this method should only update the necessary GUI components and then > > return. > > What you need to do, is create a thread for your long running process and > > kick it off. In this long running thread create another runnable that > > displays the message and returns. Then have your long running thread call > > asyncExec() every second passing in this second runnable. > > In summary, you create a thread for your long running process. That > > thread creates a GUI update runnable and passes it to asyncExec() every > > second. > Sorry, but I don't understand your answer. I think my test which outputs a > message every second is confuse. > Now I explain the problem in detail. I have a view with a toolbar. The > toolbar has a button start which starts my long running process. The > toolbar also has a stop button. After I start the long running process the > stop button is active, so the user can terminate the long running process. > There is no process dialog for the long running process. In the view I > start the long running process via Display.getCurrent().asyncExec(long > running process). Because there is no new thread, the button stop cannot > be pushed while the long running process is active. It is important that > the úser can stop the long running process via the GUI. > Can you please send me a little code snippset. Thanks!