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

Bug 120606

Summary: [variables] Static variables disappeared after clicking a variable
Product: [Eclipse Project] JDT Reporter: Samantha Chan <chanskw>
Component: DebugAssignee: Kevin Barnes <cocoakevin>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: darin.eclipse, david.newcomb
Version: 3.2   
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
testcase
none
patch
none
patch none

Description Samantha Chan CLA 2005-12-13 11:36:03 EST
I cannot always reproduce the problem, but here's the steps that I see it happening:

1.  Start Eclipse.  (seems to happen in the first launch)
2.  Create and launch the attached testcase.  The launch config stops in main.
3.  The testcase has two static variables:  hello and me.  When the debug session is first suspended, the Variables View show both static variables, assigned to null.
4.  Select one of the variables from the variables view.  Both static variables disappear.

The static variables will not be shown again in subsequent launches or if I step.
Comment 1 Samantha Chan CLA 2005-12-13 11:37:47 EST
Turning on: Show Static Variables will make the static variables appear again.

But the static variables should not be shown in the first place when the option was originally turned off.
Comment 2 Darin Wright CLA 2005-12-13 11:38:31 EST
This is lazy action init problem. The static filter is an action an is not created until the first selection change in the view.
Comment 3 Samantha Chan CLA 2005-12-13 11:44:06 EST
Created attachment 31649 [details]
testcase
Comment 4 Darin Wright CLA 2006-01-09 14:24:21 EST
In 3.1.x, it appears that the first expansion had the side effect of selecting the variable to be expanded which init'd the filters. In 3.2, we don't select when expanding (which seems more correct).

I tried setting an initial empty selection but the view never fires an original selection change of an EMPTY selection, as the variables view is configured to suppress 'equal' selections (the initial selection is also empty).
Comment 5 Darin Wright CLA 2006-04-04 17:45:55 EDT
*** Bug 127309 has been marked as a duplicate of this bug. ***
Comment 6 David Newcomb CLA 2006-04-19 06:34:12 EDT
For those of us who are suffering from not being able to see static variables how do we work around it? Where is this "Show Static Variables" option? How do we get to the option?
Comment 7 David Newcomb CLA 2006-04-19 06:39:24 EDT
Goto Variables view pane.
Click Menu button [\/]
Select "Show static variables"

Sorry, could not find it in the docs, had to google for the answer.
Comment 8 Darin Wright CLA 2006-05-11 10:29:10 EDT
note: In 3.2, the action is one level deeper in the view menu: "Java > Show Static Variables"

One possible fix for this bug is to put the filter into the content adapter for the java debugger. This way, the filter will be loaded with the adapter when content is retrieved, rather than after the fact, when a selection changes in the viewer.

This is too big of a change for 3.2, but could be a 3.2.1 or 3.3 fix.
Comment 9 Darin Wright CLA 2006-06-01 15:18:20 EDT
Created attachment 43294 [details]
patch

Patch in progress. This patch solves the problem in the variables view, but not the expressions view. The issues with the expressions view is that the root IExpression content adapter is owned by the platform (jdt does not have it's own implementation on which to override a content adapter).
Comment 10 Darin Wright CLA 2006-06-01 16:28:17 EDT
Created attachment 43307 [details]
patch

This is an alternate patch that makes things work. It's a small hack that fires a selection change with an 'object' when a new debug model is 'activated' in the variables/expressions view. It forces action delegates from all active plug-ins to be initialized. It then fires a second selection change with the current selection (possibly EMPTY).
Comment 11 Darin Wright CLA 2006-06-08 17:02:44 EDT
Released minimal (2nd) patch to TARGET_321 branch
Comment 12 Darin Wright CLA 2006-06-09 09:30:50 EDT
Released to HEAD
Comment 13 Darin Wright CLA 2006-07-06 11:43:44 EDT
Released to R3_2_maintenance.
Comment 14 Darin Wright CLA 2006-07-06 11:44:01 EDT
Please verify, Kevin.
Comment 15 Kevin Barnes CLA 2006-07-12 14:10:39 EDT
verified