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

Bug 81102

Summary: change method signature: content assist affordance broken
Product: [Eclipse Project] Platform Reporter: Tom Hofmann <eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: andre_weinand, markus.kell.r
Version: 3.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
cms.png none

Description Tom Hofmann CLA 2004-12-15 06:20:59 EST
M4 test pass (I20041214-2000-gtk)

see attached screenshot - the light bulb shows on two lines.
Comment 1 Tom Hofmann CLA 2004-12-15 06:21:16 EST
Created attachment 16633 [details]
cms.png
Comment 2 Dirk Baeumer CLA 2004-12-15 10:20:50 EST
Markus, please investigate and coordinate with Andre.
Comment 3 Markus Keller CLA 2005-02-15 13:08:28 EST
Looks like the table widget has problems calculating the relative coordinates on
GTK.
Comment 4 Markus Keller CLA 2005-03-14 13:42:16 EST
Moving to Platform/SWT.

I debugged this, and the coordinate transformations look fine.
The snippet below shows that the bug is in the GTK table drawing code.

With table.setHeaderVisible (true), the oval is not drawn around the item.
With table.setHeaderVisible (false), the oval is more or less correctly drawn.

I went back to 3.0.0, and found that this bug is already present in that build.

package p;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

public class SnippetBug81102 {

public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	Table table = new Table (shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION);
	table.setLinesVisible (true);
	table.setHeaderVisible (true); // swap this
	String[] titles = {"Column 1", "Column 1"};
	for (int i=0; i<titles.length; i++) {
		TableColumn column = new TableColumn (table, SWT.NULL);
		column.setText (titles [i]);
	}	
	int count = 5;
	for (int i=0; i<count; i++) {
		TableItem item = new TableItem (table, SWT.NULL);
		item.setText (0, "line " + i);
	}
	for (int i=0; i<titles.length; i++) {
		table.getColumn (i).pack ();
	}
	
	final TableItem item0 = table.getItem(0);
	item0.setText(1, "item0");
	
	table.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent e) {
			Rectangle b = item0.getBounds(1);
			e.gc.drawOval(b.x, b.y, b.width, b.height);
		}
	});
	
	table.setSize (table.computeSize (SWT.DEFAULT, 200));
	shell.pack ();
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
} 
Comment 5 Veronika Irvine CLA 2005-03-15 13:23:06 EST
Marking as a duplicate of bug 42416.

Please note that drawing in the paint event of a widget is not a reliable 
thing to do.  It assumes that native widgets only draw in their paint events 
and this is not guaranteed.  The paint event is really for drawing your own 
custom widget on a Composite or Canvas.  Drawing on other widgets can result 
in random cheese.

*** This bug has been marked as a duplicate of 42416 ***