Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 140077

Summary: Paint event not sent for table when no columns are visible
Product: [Eclipse Project] Platform Reporter: Darin Wright <darin.eclipse>
Component: SWTAssignee: Bogdan Gheorghe <gheorghe>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: billy.biggs, cocoakevin, ericwill, Silenio_Quarti, snorthov, veronika_irvine
Version: 3.2Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:

Description Darin Wright CLA 2006-05-03 16:44:25 EDT
3.2 RC2

Steps:
* launch a new empty workspace
* create a Java project with a main type like this:

public class HelloWorld {

	public static void main(String[] args) {
		int x = 5;
		System.out.println(x); // BREAKPOINT
	}

}

* set a breakpoint on the 2nd line as shown
* debug to the breakpoint
* in debug persepctive, close the variables view
* re-open the variables view > EMPTY

>> when we re-open the view, we do not get any 'set data' callbacks

>> if we then select a thread, we get a callback
>> if you then select the top frame, you get callbacks (and it works)

>> but closing/re-opening the view, you don't get callbacks

Another note: if you turn off columns in the variable view (drop down menu, Layout > Show Columns toggle), then it also works.

We don't have the simple SWT example test case showing this failing yet, but we can't figure out why the callbacks are not coming.

Critical for debugging on GTK
Comment 1 Darin Wright CLA 2006-05-03 16:49:05 EDT
Note: you should get org.eclipse.debug.ui from HEAD when debugging this, to avoid the NPE from bug 139853.
Comment 2 Kevin Barnes CLA 2006-05-03 18:05:34 EDT
We're trying to create columns to the trees width / number of columns. When the
variables view is opened, the trees width is 0, so we add a paintListener to
the tree and set the column widths when we get a paint event. On GTK we never
get this event, on mac and windows we do.

If I change our code to set an initial column width of 1 pixel on each of our
columns, our paintListener gets called and we're happy again.
Comment 3 Veronika Irvine CLA 2006-05-04 08:21:16 EDT
Sounds like on GTK we are only sending paint events for the cell area and since the columns are of width zero, there is no cell to be drawn.

Have you looked at this snippet:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet77.java

It sizes the columns based on table width (same code can be used for tree).

Why are you hooking a paint event?  Why not a resize event?  Do you do this only once and then remove the listener?
Comment 4 Kevin Barnes CLA 2006-05-04 09:52:58 EDT
There's no good reason that we're listening to paint instead of resize events. We just found one that worked and used it. 
Yes, the listener removes itself the first time it gets an event.
Thanks for the pointer to Snippet77.
Comment 5 Steve Northover CLA 2006-05-04 16:22:59 EDT
Changing the title and severity of this bug report to indicate the actual problem.
Comment 6 Eric Williams CLA 2016-08-17 11:54:00 EDT
(In reply to Darin Wright from comment #0)
> 3.2 RC2
> 
> Steps:
> * launch a new empty workspace
> * create a Java project with a main type like this:
> 
> public class HelloWorld {
> 
> 	public static void main(String[] args) {
> 		int x = 5;
> 		System.out.println(x); // BREAKPOINT
> 	}
> 
> }
> 
> * set a breakpoint on the 2nd line as shown
> * debug to the breakpoint
> * in debug persepctive, close the variables view
> * re-open the variables view > EMPTY
> 

I can't reproduce this behavior. Please re-open this bug if the issue persists.
Comment 7 Eric Williams CLA 2018-03-20 12:17:29 EDT
No response in awhile: closing this ticket as I cannot reproduce the issue.