Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 152641 - [java 1.6] Provide all instances feature in JDT debugger
Summary: [java 1.6] Provide all instances feature in JDT debugger
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 174233 177186
Blocks: 154115
  Show dependency tree
 
Reported: 2006-08-02 15:00 EDT by Darin Wright CLA
Modified: 2007-03-13 14:05 EDT (History)
0 users

See Also:


Attachments
workin progress (14.66 KB, patch)
2007-01-12 10:45 EST, Michael Rennie CLA
no flags Details | Diff
Updated patch (8.40 KB, patch)
2007-02-14 16:46 EST, Darin Wright CLA
no flags Details | Diff
All Instances in Editor (22.81 KB, patch)
2007-03-09 16:32 EST, Curtis Windatt CLA
no flags Details | Diff
Patch for review (28.53 KB, patch)
2007-03-13 11:24 EDT, Curtis Windatt CLA
no flags Details | Diff
Updated Patch (28.10 KB, patch)
2007-03-13 13:25 EDT, Curtis Windatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2006-08-02 15:00:52 EDT
Java 6.0 VMs may support the 'all instances' feature. We should allow users to inspect all instances of types when debugging. The action "All Instances..." should be available in:

* The variables view (visible only when an object is selected):
    - should open a popup inspector on all instances of the actual type of the selected variable
    - could be an 'object contribution' for IJavaVariable
 
* The Java editor (visible only when debugging):
    - opens all instances in a popup inspector of the selected type (i.e. selected type name).
    - contributed to class file and CU editor context menus

* The Java editor outline (visible only when debugging):
    - opens all instances in a popup inspector when a type is selected in the outline.
    - could be an 'object contribution' for IType

The inspector can create a temp array variable containing all instances. We should guard against large instance counts (but I'm not sure what the heuristic shuold be yet).
Comment 1 Darin Wright CLA 2006-08-02 15:03:58 EDT
Should create an "All Instances" command bound to something like CTRL-Shift-A.
Comment 2 Michael Rennie CLA 2006-08-28 16:47:55 EDT
first run

see AllInstancesActionDelegate, JDIAllInstancesValue

did not provide java editor or java outline compatibility.
implemented as a popup in the same fashion as the all references first run.
Comment 3 Darin Wright CLA 2006-08-29 14:22:14 EDT
The "All Instances..." action in the Java editor does not enable for me. For example, when I select any instance of "TestAllInstances" in the given code (while debugging it), the action is disabled.

public class TestAllInstances {
	
	public static void main(String[] args) {
		new TestAllInstances().foo();
	}

	private void foo() {
		System.out.println("foo"); // BREAKPOINT HERE
	}
}
Comment 4 Michael Rennie CLA 2006-08-29 15:17:00 EDT
As it should be :)

That is actually some testing code that should not have made it into the build...

It should only work for now in the variables view like all references does.
Comment 5 Michael Rennie CLA 2007-01-12 10:45:18 EST
Created attachment 56833 [details]
workin progress

This is a work in progress for adding all instances to the outline view.

All instances can be queried from the view with this patch, but runWithEvent seems to always return the coords {0, 0} so the popup always shows up in the top left corner of the window....
Comment 6 Darin Wright CLA 2007-02-14 16:46:45 EST
Created attachment 59014 [details]
Updated patch

Updated patch to work against HEAD. Adds support to browse all instances from editor outline, when a class is selected. Pending bug 174233, we can release this code. Still need to add support for selecting class names in the editor.
Comment 7 Darin Wright CLA 2007-02-15 08:57:43 EST
Released 'All Instances...' support to editor outline. Still needs to be integrated into editor (i.e. foe a selected type name).
Comment 8 Curtis Windatt CLA 2007-03-09 16:32:42 EST
Created attachment 60491 [details]
All Instances in Editor

Patch adds support for all instances action in java editors.  The start of the selection (or the location of the caret if there is no selection) must be inside a java type.

- Pretty much complete, but still a few issues, more testing needed next week.
- If there is an easy way to get it to work when a constructor is selected that would be useful, as it is easy to get confused when you select part of Vector() and you the error says you haven't selected a java type.  
- There is also a problem with getting the anchor when working in the outline view.  The editor anchor defaults to the caret, and the variables view correctly gets the location of the selected element, but the outline uses the default anchor which ends up in the variables view.
- If an icon is produced for instance/reference entries, we should use it to replace the blue triangles currently used.
- The action's help hasn't been created.

Doesn't work if a constructor is selected (slightly confusing since Vector and Vector()
Comment 9 Curtis Windatt CLA 2007-03-13 11:24:36 EDT
Created attachment 60675 [details]
Patch for review
Comment 10 Curtis Windatt CLA 2007-03-13 11:25:55 EDT
Comment on attachment 60675 [details]
Patch for review

Updated patch for review.
Comment 11 Curtis Windatt CLA 2007-03-13 11:45:07 EDT
Mike, please review the patch
Comment 12 Curtis Windatt CLA 2007-03-13 13:25:50 EDT
Created attachment 60698 [details]
Updated Patch

Updated patch to resolve conflicts with HEAD.
Comment 13 Michael Rennie CLA 2007-03-13 14:04:55 EDT
The feature works as it should, but the popup does not show in the correct location in the outline view. This is because there is no way to get a handle to the current control in the view, and therefore we cannot determine where to open the popup.

I will release the patch, and file the appropriate bugs against jdt.ui for a control adapter in the outline view
Comment 14 Michael Rennie CLA 2007-03-13 14:05:23 EDT
verified