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

Bug 119025

Summary: Selection and detail string in Variables view lost if label changed
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: DebugAssignee: Samantha Chan <chanskw>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: chanskw, cocoakevin, darin.eclipse, eclipse, jcompagner, n.a.edgar, philippe_mulet
Version: 3.2   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
work in progress none

Description Markus Keller CLA 2005-12-02 08:35:45 EST
I20051130-1215

public class Try  {
    public static void main(String[] args) {
        String[] chars= {"a", "b", "c", "d"};
        for (int i= 0; i < chars.length; i++) {
            String ch= chars[i];
            System.out.println(ch); // breakpoint here
        }
    }
}

- set the breakpoint where indicated
- start debugging
- select 'ch= "a"' in the Variables view
- resume
 => On the second hit of the breakpoint, the variable 'ch' is not selected any more. This is a regression compared to 3.1.1.

If you select 'chars= String[4]  (id=12)', then it works slightly better: The variable is still selected in the Variables view, but the detail pane stays empty. I would expect to see the new value automatically, without having to select the variable again. This also worked fine in 3.1.1.
Comment 1 Johan Compagner CLA 2006-03-22 09:07:06 EST
now with the new variables view it is a bit better because you can configure it so that the value is always displayed in a column 

But it would be nice that the selection (and the tree state) is remembered as good as it can be and that the detail area is filled with the toString()



Comment 2 Darin Wright CLA 2006-03-30 09:21:28 EST
*** Bug 134070 has been marked as a duplicate of this bug. ***
Comment 3 Darin Wright CLA 2006-03-30 17:03:18 EST
*** Bug 128688 has been marked as a duplicate of this bug. ***
Comment 4 Darin Wright CLA 2006-03-31 16:59:26 EST
Created attachment 37438 [details]
work in progress

This patch encodes/decodes expansion/selection using indicies to indicate which elements were expanded/selected.
Comment 5 Darin Wright CLA 2006-04-03 13:28:40 EDT
Fixed selection/expansion state. Changes to AbstractViewerState, MemoryBlocksTreeViewPane, VariablesView and ViewerState. The selection/expansion is now persisted as a path of indicies based on the index of selected/expanded elements in the tree. This avoids having to compare element labels.

There is a side effect: when moving from one frame to the next, if a frame has no "selection/expansion state", the state from the previous viewer input is applied. This will expand/select items based on index instead of name, which may have an unexpected result. When the frames are similar (same receiver), this works well - but when the frames are unrelated, it does not work as well (for example, the first item is expanded and its 3rd child selected). Since the content of the view is now generic, we cannot infer any meaning from the labels and determine if the two inputs are related. Will file this issue to be considered in next relase (may require model to provide more API to persist/restore expansion in a model specific way).

Still need to address detail pane update.
Comment 6 Darin Wright CLA 2006-04-03 15:16:36 EDT
The detail pane required a post selection change event to be fired. Fix is to fire a post selection after an "attemp selection" is successful. Changes to AsynchronousViewer.
Comment 7 Darin Wright CLA 2006-04-03 15:29:27 EDT
Fixed. Please verify, Samantha.
Comment 8 Darin Wright CLA 2006-04-03 15:29:48 EDT
Please verify, Samantha.
Comment 9 Darin Wright CLA 2006-04-04 17:08:47 EDT
*** Bug 120687 has been marked as a duplicate of this bug. ***
Comment 10 Darin Wright CLA 2006-04-04 17:10:08 EDT
*** Bug 120628 has been marked as a duplicate of this bug. ***
Comment 11 Darin Wright CLA 2006-04-10 11:04:56 EDT
*** Bug 135696 has been marked as a duplicate of this bug. ***
Comment 12 Samantha Chan CLA 2006-04-27 18:06:13 EDT
Darin -
Trying to verify this one. With the introduction of post-selection event, I am wondering if VariablesViewer still needs to call VariablesView#populateDetailsPane in #updateComplete.  When the view is updated, and if there is a selection, the listener would always get the post selection event which will cause the details pane to be populated.  I am seeing #populateDetailsPaneFromSelection being called twice every time I hit the breakpoint.  Once from #updateComplete and once from the listener.  Updating after a step would only call that method once.
Am I missing a case here?  Thanks...
Sam
Comment 13 Samantha Chan CLA 2006-05-11 11:20:15 EDT
Verified that although the method is called mutilple times, the model presentation is only called once.  This is ok for 3.2.

Need to address this bug before we can improve on not calling #populateDetailsPaneFromSelection multiple times.  We need to know when update is finished.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=126040