Bug 185673 [Viewers] Mac only: In variables and expressions views, up/down keyboard navigation doesn't work correctly
Build ID: I20070503-1400 On Mac, if you use the down arrow key (not the scrollbar) to move down the variables view or expressions view, it does not work correctly -- sometimes, after pressing down arrow, the selection jumps back to the first line in the view. It reproduces consistently, and is not timing-sensitive. Steps To Reproduce: 1. Make a new Java project "J", and paste this program into it: public class J { public static void main(String[] args) { int[] a = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; System.out.println("breakpoint here"); } } 2. Switch to the Debug perspective, and make sure the Variables view is visible, and is not too tall. Make it about 4 1/2 lines tall. 3. Set a breakpoint on the println line. 4. Debug. When you hit the breakpoint, the variables view should have the empty "args" array, plus array "a". 5. Click the triangle to expand "a". You should now see a line for a[0], a line for a[1], and half of the line for a[2]. 6. Click in the variables view to give it keyboard focus, on the line for array "a". 7. Press down arrow a few times. You can pause between each press of the key; this is not a timing-sensitive issue. For the first few lines, each time you press down arrow, the cursor will move down a line, as it should. When you are on a[1] and press down arrow, the screen scrolls about 1/2 line, and now a[2] is correctly selected. But the next time you press down-arrow, something strange happens: the view does scroll, so a[3] is visible, but there is no blue highlight indicating that a[3] is selected. Then, if you press down-arrow one more time, the scrollbar jumps all the way to the top, and the very first line of the view, "args", is selected. If you repeat the process, you will find that this time, you get one line farther: a[3] will be reached successfully, but a[4] will be where the weirdness starts. Each time you repeat it, you will get one line farther down before it starts messing up. More information: The problem does not reproduce in any other view, such as breakpoints, debug, outline, etc., so I think the problem is specific to variables and expressions. Also, it is a core bug, not a JDT bug, because it reproduces when debugging other languages. Does not reproduce on Windows. I didn't have a chance to try any other platforms.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
/*******************************************************************************
 * Copyright (c) 2004, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Tom Schindl <tom.schindl@bestsolution.at> - concept of ViewerRow,
 *                                                 refactoring (bug 153993), bug 167323
 *******************************************************************************/
package org.eclipse.jface.viewers;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.jface.util.Policy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.TreeEvent;
import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Listener;