Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 140932 - [expressions] Expression view does not update properly
Summary: [expressions] Expression view does not update properly
Status: RESOLVED DUPLICATE of bug 143805
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-09 16:31 EDT by Darin Wright CLA
Modified: 2006-07-14 12:21 EDT (History)
1 user (show)

See Also:


Attachments
screenshot (14.01 KB, image/png)
2006-05-09 16:32 EDT, Darin Wright CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2006-05-09 16:31:40 EDT
RC3 (with fix for bug 139593 applied)

Use the following program:

public class Strings {
	public static void main(String[] args) {
		String[] strings = new String[1000];
		strings[0] = "a";
		strings[1] = "b";

		System.out.println("over over"); // breakpoint here

	}

}


* debug to the breakpoint
* open the expressions view
* add 'strings' as an expression
* expand the second range 100...199
* expand the first range 0...99
* debug another program to a breakpoint
* select its stack frame (that does not have a variable named 'strings')
* expression view left in wierd state
Comment 1 Darin Wright CLA 2006-05-09 16:32:41 EDT
Created attachment 40866 [details]
screenshot
Comment 2 Darin Wright CLA 2006-05-09 17:35:29 EDT
Appears to that the view scrolls to make the "error message" node not visible. Since it is not visible, it does not get a 'set data' callback when the tree is cleared, and it does not force its children to refresh. Once scrolled into view, the children are properly updated. Can reproduce with SWT example:

/*******************************************************************************
 * Copyright (c) 2006 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
 *******************************************************************************/
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;

public class Clear {
	
	static int counter = 0;
	
	public static void main (String [] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		shell.setLayout(new FillLayout());
		final Tree tree = new Tree(shell, SWT.BORDER | SWT.VIRTUAL);
		tree.setItemCount(1);
		TreeItem root = tree.getItem(0);
		root.setItemCount(2);
		TreeItem first = root.getItem(0);
		first.setItemCount(100);
		TreeItem sec = root.getItem(1);
		sec.setItemCount(100);
		
		tree.addListener(SWT.SetData, new Listener() {
			public void handleEvent(Event event) {
				TreeItem item = (TreeItem) event.item;
				int level = 0;
				TreeItem parent = item.getParentItem();
				while (parent != null) {
					level++;
					parent = parent.getParentItem();
				}
				if (level == 1 && event.index == 0 && counter > 0) {
					item.setItemCount(0);
				}
				item.setText("item " + event.index + " " + counter);
			}
		});
		
		Button b = new Button(shell, SWT.PUSH);
		b.setText("do it");
		b.addListener(SWT.Selection, new Listener() {
			public void handleEvent(Event e) {
				counter++;
				tree.clear(0, true);
			}
		});
		shell.setSize(150,150);
		shell.open ();
		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ()) display.sleep ();
		}
		display.dispose ();
	}
}
Comment 3 Darin Wright CLA 2006-07-14 12:21:12 EDT
This works with the fix to bug 143805

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