Delicious wraps
Ever needed to perform some computation in another thread, and the return the result. Typically what you do is you create a Runnable, where you perform this computation, run it in the separate thread, wait for it to complete and then somehow get the value out of that runnable and return it to the caller. In SWT, this type of pattern is quite common when you need access to some widget values from outside of Display thread: Nothing really revolutionary in this piece of code — Since the only safe way to ask text of the widget is to ask it from the display thread, I am invoking syncExec on the text widget's display. To access the text field itself from the anonymous runnable, I have to declare it final . Also, to be able to return the value I need to write it to a local variable retValue , which needs to be declared final as well so that I could reference it from the inner anonymous class run method body. In order to be able to write to the retVal , I also need to declare...