The problem I met is that refresh(true, false) method of org.eclipse.jface.viewers.TableViewer class behaves as refresh(true, true) on Linux platforms.
I found an opened bug for this case: https://bugs.eclipse.org/bugs/show_bug.cgi?id=414455 but the current SWT 4.3 stable version doesn't contain the fix.
To overcome this problem temporary (until SWT 4.4 is released) I used "SWT.MULTI" style bit during TableViewer creation.
I played with different styles, but it is the only way to avoid the problem. "SWT.NONE" didn't help as well because of the logic inside org.eclipse.swt.widgets.Tablet constructor which overwrites "style" parameter:
A software engineer's technical blog about programming languages, computer graphics, problem solving, systems configuration, books and much more.
Showing posts with label SWT. Show all posts
Showing posts with label SWT. Show all posts
Thursday, January 2, 2014
Monday, November 14, 2011
org.eclipse.swt.SWTException: Invalid thread access
Recently, I've faced with SWTException error when was trying to insert a new TableItem into the SWT Table from another thread. Reading java doc about TableItem class I found out, that with creation a new instance of this class, SWTException may occurred:
Throws SWTException: if not called from the thread that created the parent
It means that I can't create a TableItem instance in the thread which is distinct from that one, in which Table was created.
I wrote a simple program to reproduce my problem: it's a window with one button and with a table which has a single column. When pressing the button a new thread is started. In this thread there's a cycle in which 5 table items are created with timed out = 1 sec.
Here's a code snippet, which represents a first attempt:
Subscribe to:
Posts (Atom)