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

Bug 285401

Summary: [Widgets] tracker leaves cheese over tree
Product: [Eclipse Project] Platform Reporter: Andrei Diaconu <andi_dm1>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact: Felipe Heidrich <eclipse.felipe>
Severity: normal    
Priority: P3 CC: andi_dm1, schnuddelbuddel, Silenio_Quarti
Version: 3.5Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Andrei Diaconu CLA 2009-08-03 04:57:08 EDT
Run the following snippet. Click on the tree and drag the mouse, so that a tracker appears. While the tracker is open, the tree item under the top left corner of the tracker is selected.

Move the mouse so that the selected item changes. You will notice that some parts of the tracker do not get deleted, and are left visible.

Here is the snippet:

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;

public class TrackerCheese {
	public static void main(String[] args) {
		final Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setSize(200, 200);
		shell.setLayout(new FillLayout());

		final Tree tree = new Tree(shell, SWT.NONE);
		for (int i = 0; i < 3; i++) {
			TreeItem item = new TreeItem(tree, SWT.NONE);
			item.setText(Integer.toString(i));
		}

		tree.addListener(SWT.MouseDown, new Listener() {
			@Override
			public void handleEvent(Event e) {
				final Tracker tracker = new Tracker(tree, SWT.RESIZE);
				tracker.setRectangles(new Rectangle[] {new Rectangle(e.x, e.y,
						0, 0)});
				tracker.addListener(SWT.Resize, new Listener() {
					@Override
					public void handleEvent(Event e) {
						final Rectangle rectangle = tracker.getRectangles()[0];
						final TreeItem item = tree.getItem(new Point(
								rectangle.x, rectangle.y));
						if (item != null) {
							tree.setSelection(item);
						} else {
							tree.setSelection(new TreeItem[0]);
						}
					}
				});
				tracker.open();
			}
		});

		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 1 Bogdan Gheorghe CLA 2009-08-05 17:55:51 EDT
Reproducible in I20090805-0800 when you move the tracker upwards.
Comment 2 Leo Ufimtsev CLA 2017-08-03 12:31:58 EDT
This is a one-off bulk update. (The last one in the triage migration).

Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process:
https://wiki.eclipse.org/SWT/Devel/Triage

See Bug 518478 for details.

Tag for notification/mail filters:
@TriageBulkUpdate
Comment 3 Eclipse Genie CLA 2020-06-23 12:49:27 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.