Bug 243894

Summary: Debug view should not scroll to right when breakpoint is hit
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, Silenio_Quarti
Version: 3.5Keywords: polish
Target Milestone: 3.7   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
fix none

Description Markus Keller CLA 2008-08-12 11:22:29 EDT
I20080807-1402, was OK in 3.3.2 and 3.4.

Paste the class below to the Package Explorer, set the breakpoint, and then debug as Java application. When the breakpoint is hit (in both threads), make sure that the Debug view is so narrow that its toolbar just fits on one row (the view then shows a horizontal scroll bar). Press F8.
=> Was: Tree scrolls to the right
=> Expected: Tree should not scroll horizontally

Even when you drag the thumb to the left, pressing F8 always scrolls to the right again.

package xy;

public class Try {

	public static void main(String[] args) {
		new Thread("Worker") {
			public void run() {
				goDeep();
			}
		}.start();
		goDeep();
	}

	static void goDeep() {
		for (int i = 0; i < 10; i++) {
			deep(50);
		}
	}

	private static void deep(int i) {
		if (i > 0) {
			deep(i - 1);
		} else {
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			System.out.println("hi"); // breakpoint
		}
	}
}
Comment 1 Markus Keller CLA 2008-11-12 09:33:11 EST
Still very annoying in I20081111-0800. When I debug threading problems, I often lose context in the tree and have to scroll back manually.
Comment 2 Markus Keller CLA 2011-03-11 09:30:21 EST
*** Bug 307735 has been marked as a duplicate of this bug. ***
Comment 3 Markus Keller CLA 2011-03-11 09:32:32 EST
This is still quite annoying in I20110310-1119. Would make a great polish item. If the problem is in SWT, please move the bug.
Comment 4 Silenio Quarti CLA 2011-03-25 11:53:18 EDT
The problem happens because Tree.setTopItem() is called for the thread tree item (Thread [main] ...) which is longer than the tree itself. The OS call to set the top item also scrolls horizontally to reveal the item's text.

I believe Tree.setTopItem() should not scroll horizontally. This is the behavior in other platforms.
Comment 5 Silenio Quarti CLA 2011-03-25 11:54:18 EDT
Created attachment 191916 [details]
fix
Comment 6 Silenio Quarti CLA 2011-03-25 11:55:43 EDT
Fixed > 20110325