- 전체
- JAVA 일반
- JAVA 수학
- JAVA 그래픽
- JAVA 자료구조
- JAVA 인공지능
- JAVA 인터넷
- Java Framework
- Java GUI (AWT,SWING,SWT,JFACE)
- SWT and RCP (web RAP/RWT)[eclipse], EMF
SWT and RCP (web RAP/RWT)[eclipse], EMF Eclipse RCP multithreading
2015.11.07 22:40
Eclipse RCP multithreading
I have an eclipse rcp application. And I have a command when this command is executing. I need to start a thread. After execution of this thread GUI must be updated. But I suppose that this thread or other non-SWT thread cannot update GUI. But it seems reasonable. When I was trying to do that I got Exception in thread "Thread-5" org.eclipse.swt.SWTException: Invalid thread access . How I can make this goal? |
You're facing the most common exception in SWT world! Invalid Thread Access means only one thing: you want to modify or simply access a GUI element and you're doing it in a thread that is not the GUI thread. It never happens when your code comes a click on button or something like this, but, when you're using background process or asynchronous notifications, it occurs all the time. There's one solution: execute your code in a specific block:
or
In the first case, the execution is synchronous. The calling thread waits for the run method to be executed. In the second case, the calling thread is not waiting. To learn more about threads in Eclipse application, look at the stack in your Debug view (in debug mode). The first thread called Main is the UI thread. |
[출처] http://stackoverflow.com/questions/10621554/eclipse-rcp-multithreading
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.