Bug 152641
[java 1.6] Provide all instances feature in JDT debugger
diff --git a/org.eclipse.jdt.debug.ui/icons/full/elcl16/all_instances.gif b/org.eclipse.jdt.debug.ui/icons/full/elcl16/all_instances.gif
new file mode 100644
index 0000000..6a9fbc8
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/icons/full/elcl16/all_instances.gif
Binary files differ
diff --git a/org.eclipse.jdt.debug.ui/plugin.properties b/org.eclipse.jdt.debug.ui/plugin.properties
index 21aa06c..a720892 100644
--- a/org.eclipse.jdt.debug.ui/plugin.properties
+++ b/org.eclipse.jdt.debug.ui/plugin.properties
@@ -18,6 +18,8 @@
 addTypeStepFilterAction.tooltip=Filter the selected type(s)
 addPackageStepFilterAction.label=Filter Pac&kage
 addPackageStepFilterAction.tooltip=Filter the selected package(s)
+allinstances.label=All Ins&tances...
+allinstances.tooltip=Displays a popup window showing all live instances of the selected object in the current running VM
 
 caughtAction.label=&Caught
 
@@ -195,6 +197,8 @@
 ActionDefinition.watch.name=Watch
 ActionDefinition.allReferences.name=All References
 ActionDefinition.allReferences.description=Inspect all references to the selected object
+ActionDefinition.allInstances.name=All Instances
+ActionDefinition.allInstances.description=View all instances of the selected object loaded in the target VM
 
 ViewCommand.displayView.name=Display
 ViewCommand.displayView.description=Show the Display view
diff --git a/org.eclipse.jdt.debug.ui/plugin.xml b/org.eclipse.jdt.debug.ui/plugin.xml
index a786453..49003c9 100644
--- a/org.eclipse.jdt.debug.ui/plugin.xml
+++ b/org.eclipse.jdt.debug.ui/plugin.xml
@@ -1255,11 +1255,12 @@
                id="org.eclipse.jdt.debug.ui.actions.EnableDisableBreakpointRulerActionDelegate">
          </action>
          <action
-               label="%AddBreakpoint.label"
-               helpContextId="manage_breakpoint_action_context"
                class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
-               menubarPath="debug"
-               id="org.eclipse.jdt.debug.ui.actions.BreakpointRulerActionDelegate">
+               helpContextId="manage_breakpoint_action_context"
+               icon="icons/full/obj16/brkp_obj.gif"
+               id="org.eclipse.jdt.debug.ui.actions.BreakpointRulerActionDelegate"
+               label="%AddBreakpoint.label"
+               menubarPath="debug">
          </action>
       </viewerContribution>
       <viewerContribution
@@ -1280,11 +1281,12 @@
                id="org.eclipse.jdt.debug.ui.actions.EnableDisableBreakpointRulerActionDelegate">
          </action>
          <action
-               label="%AddBreakpoint.label"
-               helpContextId="manage_breakpoint_action_context"
                class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
-               menubarPath="debug"
-               id="org.eclipse.jdt.debug.ui.actions.BreakpointRulerActionDelegate">
+               helpContextId="manage_breakpoint_action_context"
+               icon="icons/full/obj16/brkp_obj.gif"
+               id="org.eclipse.jdt.debug.ui.actions.BreakpointRulerActionDelegate"
+               label="%AddBreakpoint.label"
+               menubarPath="debug">
          </action>
       </viewerContribution>
       <viewerContribution
@@ -1302,32 +1304,13 @@
             </and>
          </visibility>
          <action
-               label="%stepIntoSelectionAction.label"
-               helpContextId="step_into_selection_action_context"
-               class="org.eclipse.jdt.internal.debug.ui.actions.StepIntoSelectionActionDelegate"
-               menubarPath="additions"
-               enablesFor="*"
-               id="org.eclipse.jdt.debug.ui.cuPopup.StepIntoSelection"
-               definitionId="org.eclipse.jdt.debug.ui.commands.StepIntoSelection">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.instanceof.IJavaStackFrame"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
-         </action>
-         <action
-               label="%runToLineAction.label"
-               helpContextId="run_to_line_action_context"
-               definitionId="org.eclipse.debug.ui.commands.RunToLine"
                class="org.eclipse.debug.ui.actions.RunToLineActionDelegate"
-               menubarPath="additions"
-               id="org.eclipse.jdt.debug.ui.cuPopup.RunToLine">
+               definitionId="org.eclipse.debug.ui.commands.RunToLine"
+               helpContextId="run_to_line_action_context"
+               icon="icons/full/elcl16/runtoline_co.gif"
+               id="org.eclipse.jdt.debug.ui.cuPopup.RunToLine"
+               label="%runToLineAction.label"
+               menubarPath="additions">
          </action>
          <action
                label="%Execute.label"
@@ -1338,17 +1321,6 @@
                menubarPath="additions"
                enablesFor="+"
                id="org.eclipse.jdt.debug.ui.cuPopup.Execute">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Display.label"
@@ -1358,17 +1330,6 @@
                class="org.eclipse.jdt.internal.debug.ui.actions.PopupDisplayAction"
                menubarPath="additions"
                id="org.eclipse.jdt.debug.ui.cuPopup.Display">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Inspect.label"
@@ -1378,17 +1339,6 @@
                class="org.eclipse.jdt.internal.debug.ui.actions.PopupInspectAction"
                menubarPath="additions"
                id="org.eclipse.jdt.debug.ui.cuPopup.Inspect">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Watch.label"
@@ -1398,17 +1348,60 @@
                menubarPath="additions"
                enablesFor="+"
                id="org.eclipse.jdt.debug.ui.cuPopup.Watch">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
+         </action>
+      </viewerContribution>
+      <viewerContribution
+            targetID="#CompilationUnitEditorContext"
+            id="org.eclipse.jdt.debug.ui.CUPopupActions">
+         <visibility>
+            <and>
+               <systemProperty
+                     name="org.eclipse.jdt.debug.ui.debuggerActive"
+                     value="true">
+               </systemProperty>
+               <systemProperty
+                        name="org.eclipse.jdt.debug.ui.instanceof.IJavaStackFrame"
                         value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
+               </systemProperty>
+               <objectClass
+                     name="org.eclipse.jface.text.ITextSelection">
+               </objectClass>
+            </and>
+         </visibility>
+         <action
+               class="org.eclipse.jdt.internal.debug.ui.actions.StepIntoSelectionActionDelegate"
+               definitionId="org.eclipse.jdt.debug.ui.commands.StepIntoSelection"
+               enablesFor="*"
+               helpContextId="step_into_selection_action_context"
+               icon="icons/full/elcl16/stepinto_co.gif"
+               id="org.eclipse.jdt.debug.ui.cuPopup.StepIntoSelection"
+               label="%stepIntoSelectionAction.label"
+               menubarPath="additions">
+         </action>
+      </viewerContribution>
+      <viewerContribution
+            targetID="#CompilationUnitEditorContext"
+            id="org.eclipse.jdt.debug.ui.CUPopupActions">
+         <visibility>
+            <and>
+               <systemProperty
+                     name="org.eclipse.jdt.debug.ui.debuggerActive"
+                     value="true">
+               </systemProperty>
+               <objectClass
+                     name="org.eclipse.jface.text.ITextSelection">
+               </objectClass>
+            </and>
+         </visibility>
+         <action
+               class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllInstancesActionDelegate"
+               enablesFor="1"
+               helpContextId="all_instances_action_context"
+               icon="icons/full/elcl16/all_instances.gif"
+               id="org.eclipse.jdt.debug.ui.allInstances"
+               label="%allinstances.label"
+               menubarPath="additions"
+               tooltip="%allinstances.tooltip">
          </action>
       </viewerContribution>
       <viewerContribution
@@ -1426,32 +1419,13 @@
             </and>
          </visibility>
          <action
-               label="%stepIntoSelectionAction.label"
-               helpContextId="step_into_selection_action_context"
-               class="org.eclipse.jdt.internal.debug.ui.actions.StepIntoSelectionActionDelegate"
-               menubarPath="additions"
-               enablesFor="*"
-               id="org.eclipse.jdt.debug.ui.cfPopup.StepIntoSelection"
-               definitionId="org.eclipse.jdt.debug.ui.commands.StepIntoSelection">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.instanceof.IJavaStackFrame"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
-         </action>
-         <action
-               label="%runToLineAction.label"
-               helpContextId="run_to_line_action_context"
-               definitionId="org.eclipse.debug.ui.commands.RunToLine"
                class="org.eclipse.debug.ui.actions.RunToLineActionDelegate"
-               menubarPath="additions"
-               id="org.eclipse.jdt.debug.ui.cuPopup.RunToLine">
+               definitionId="org.eclipse.debug.ui.commands.RunToLine"
+               helpContextId="run_to_line_action_context"
+               icon="icons/full/elcl16/runtoline_co.gif"
+               id="org.eclipse.jdt.debug.ui.cuPopup.RunToLine"
+               label="%runToLineAction.label"
+               menubarPath="additions">
          </action>         
          <action
                label="%Execute.label"
@@ -1462,17 +1436,6 @@
                menubarPath="additions"
                enablesFor="+"
                id="org.eclipse.jdt.debug.ui.cfPopup.Execute">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Display.label"
@@ -1482,17 +1445,6 @@
                class="org.eclipse.jdt.internal.debug.ui.actions.PopupDisplayAction"
                menubarPath="additions"
                id="org.eclipse.jdt.debug.ui.cfPopup.Display">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Inspect.label"
@@ -1502,17 +1454,6 @@
                class="org.eclipse.jdt.internal.debug.ui.actions.PopupInspectAction"
                menubarPath="additions"
                id="org.eclipse.jdt.debug.ui.cfPopup.Inspect">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
-                        value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
          </action>
          <action
                label="%Watch.label"
@@ -1522,17 +1463,60 @@
                menubarPath="additions"
                enablesFor="+"
                id="org.eclipse.jdt.debug.ui.cfPopup.Watch">
-            <enablement>
-               <and>
-                  <systemProperty
-                        name="org.eclipse.jdt.debug.ui.debuggerActive"
+         </action>
+      </viewerContribution>
+      <viewerContribution
+            targetID="#ClassFileEditorContext"
+            id="org.eclipse.jdt.debug.ui.CFPopupActions">
+         <visibility>
+            <and>
+               <systemProperty
+                     name="org.eclipse.jdt.debug.ui.debuggerActive"
+                     value="true">
+               </systemProperty>
+               <systemProperty
+                        name="org.eclipse.jdt.debug.ui.instanceof.IJavaStackFrame"
                         value="true">
-                  </systemProperty>
-                  <objectClass
-                        name="org.eclipse.jface.text.ITextSelection">
-                  </objectClass>
-               </and>
-            </enablement>
+               </systemProperty>
+               <objectClass
+                     name="org.eclipse.jface.text.ITextSelection">
+               </objectClass>
+            </and>
+         </visibility>
+         <action
+               class="org.eclipse.jdt.internal.debug.ui.actions.StepIntoSelectionActionDelegate"
+               definitionId="org.eclipse.jdt.debug.ui.commands.StepIntoSelection"
+               enablesFor="*"
+               helpContextId="step_into_selection_action_context"
+               icon="icons/full/elcl16/stepinto_co.gif"
+               id="org.eclipse.jdt.debug.ui.cfPopup.StepIntoSelection"
+               label="%stepIntoSelectionAction.label"
+               menubarPath="additions">
+         </action>
+       </viewerContribution>
+       <viewerContribution
+            targetID="#ClassFileEditorContext"
+            id="org.eclipse.jdt.debug.ui.CFPopupActions">
+         <visibility>
+            <and>
+               <systemProperty
+                     name="org.eclipse.jdt.debug.ui.debuggerActive"
+                     value="true">
+               </systemProperty>
+               <objectClass
+                     name="org.eclipse.jface.text.ITextSelection">
+               </objectClass>
+            </and>
+         </visibility>
+         <action
+               class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllInstancesActionDelegate"
+               enablesFor="1"
+               helpContextId="all_instances_action_context"
+               icon="icons/full/elcl16/all_instances.gif"
+               id="org.eclipse.jdt.debug.ui.allInstances"
+               label="%allinstances.label"
+               menubarPath="additions"
+               tooltip="%allinstances.tooltip">
          </action>
       </viewerContribution>
       <objectContribution
@@ -1555,12 +1539,13 @@
 	            </and>
          </visibility>
          <action
-               label="%manageMethodBreakpointAction.label"
-               helpContextId="manage_method_breakpoint_action_context"
                class="org.eclipse.debug.ui.actions.ToggleMethodBreakpointActionDelegate"
-               menubarPath="additions"
                enablesFor="+"
-               id="org.eclipse.jdt.debug.ui.MethodBreakpoint">
+               helpContextId="manage_method_breakpoint_action_context"
+               icon="icons/full/obj16/brkp_obj.gif"
+               id="org.eclipse.jdt.debug.ui.MethodBreakpoint"
+               label="%manageMethodBreakpointAction.label"
+               menubarPath="additions">
          </action>
       </objectContribution>
       <objectContribution
@@ -1586,24 +1571,26 @@
                 </and>
          </visibility>            
          <action
-               label="%manageWatchpointAction.label"
-               helpContextId="manage_watchpoint_action_context"
                class="org.eclipse.debug.ui.actions.ToggleWatchpointActionDelegate"
-               menubarPath="additions"
                enablesFor="+"
-               id="org.eclipse.jdt.debug.ui.Watchpoint">
+               helpContextId="manage_watchpoint_action_context"
+               icon="icons/full/obj16/readwrite_obj.gif"
+               id="org.eclipse.jdt.debug.ui.Watchpoint"
+               label="%manageWatchpointAction.label"
+               menubarPath="additions">
          </action>
       </objectContribution>
       <objectContribution
             objectClass="org.eclipse.jdt.core.IType"
-            id="org.eclipse.jdt.debug.ui.ClassLoadBreakpointActions">
+            id="org.eclipse.jdt.debug.ui.ITypePopupActions">
          <action
-               label="%toggleClassPrepareAction.label"
-               helpContextId="toggle_class_prepare_action_context"
                class="org.eclipse.jdt.internal.debug.ui.breakpoints.ToggleClassPrepareBreakpointAction"
-               menubarPath="additions"
                enablesFor="+"
-               id="org.eclipse.jdt.debug.ui.ToggleClassPrepare">
+               helpContextId="toggle_class_prepare_action_context"
+               icon="icons/full/obj16/class_obj.gif"
+               id="org.eclipse.jdt.debug.ui.ToggleClassPrepare"
+               label="%toggleClassPrepareAction.label"
+               menubarPath="additions">
          </action>
          <visibility>
             <and>
@@ -1621,7 +1608,40 @@
                </not>
             </and>
          </visibility>
-      </objectContribution>      
+      </objectContribution>   
+      <objectContribution
+            objectClass="org.eclipse.jdt.core.IType"
+            id="org.eclipse.jdt.debug.ui.ITypePopupActions">
+         <action
+               class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllInstancesActionDelegate"
+               helpContextId="all_instances_action_context"
+               icon="icons/full/elcl16/all_instances.gif"
+               id="org.eclipse.jdt.debug.ui.allInstances"
+               label="%allinstances.label"
+               menubarPath="additions"
+               tooltip="%allinstances.tooltip">
+         </action>
+         <visibility>
+            <and>
+               <objectState
+                     name="MemberActionFilter"
+                     value="isInstanceRetrievalAvailable">
+               </objectState>
+               <not>
+                  <objectState
+                        name="MemberActionFilter"
+                        value="isInterface">
+                  </objectState>
+               </not>
+               <not>
+                  <objectState
+                        name="MemberActionFilter"
+                        value="isRemote">
+                  </objectState>
+               </not>
+            </and>
+         </visibility>
+      </objectContribution>
       <objectContribution
             objectClass="org.eclipse.jdt.debug.core.IJavaVariable"
             id="org.eclipse.jdt.debug.ui.InstanceFiltersActions">
@@ -1642,12 +1662,13 @@
             objectClass="org.eclipse.jdt.debug.core.IJavaFieldVariable"
             id="org.eclipse.jdt.debug.ui.WatchpointActions">
          <action
-               label="%manageWatchpointAction.label"
-               helpContextId="manage_watchpoint_action_context"
                class="org.eclipse.debug.ui.actions.ToggleWatchpointActionDelegate"
-               menubarPath="additions"
                enablesFor="+"
-               id="org.eclipse.jdt.debug.ui.VariableWatchpoint">
+               helpContextId="manage_watchpoint_action_context"
+               icon="icons/full/obj16/readwrite_obj.gif"
+               id="org.eclipse.jdt.debug.ui.VariableWatchpoint"
+               label="%manageWatchpointAction.label"
+               menubarPath="openOnGroup">
          </action>
          <visibility>
             <objectState
@@ -1680,6 +1701,33 @@
             id="org.eclipse.jdt.debug.ui.FilteredJavaVariableActions"
             objectClass="org.eclipse.jdt.debug.core.IJavaVariable">
          <action
+               class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllInstancesActionDelegate"
+               definitionId="org.eclipse.jdt.debug.ui.commands.AllInstances"
+               enablesFor="1"
+               helpContextId="all_instances_action_context"
+               icon="icons/full/elcl16/all_instances.gif"
+               id="org.eclipse.jdt.debug.ui.allInstances"
+               label="%allinstances.label"
+               menubarPath="emptyNavigationGroup"
+               tooltip="%allinstances.tooltip">
+         </action>
+         <visibility>
+            <and>
+               <objectState
+                     name="PrimitiveVariableActionFilter"
+                     value="isPrimitive">
+               </objectState>
+               <objectState
+                     name="JavaVariableFilter"
+                     value="isInstanceRetrievalAvailable">
+               </objectState>
+            </and>
+         </visibility>
+      </objectContribution>
+	  <objectContribution
+            id="org.eclipse.jdt.debug.ui.FilteredJavaVariableActions"
+            objectClass="org.eclipse.jdt.debug.core.IJavaVariable">
+         <action
                class="org.eclipse.jdt.internal.debug.ui.heapwalking.AllReferencesActionDelegate"
                definitionId="org.eclipse.jdt.debug.ui.commands.AllReferences"
                enablesFor="1"
@@ -2131,12 +2179,18 @@
             categoryId="org.eclipse.debug.ui.category.run"
             description="%ActionDefinition.watch.description"
             id="org.eclipse.jdt.debug.ui.commands.Watch"
-            name="%ActionDefinition.watch.name"/>
+            name="%ActionDefinition.watch.name"/> 
       <command
             categoryId="org.eclipse.debug.ui.category.run"
             description="%ActionDefinition.allReferences.description"
             id="org.eclipse.jdt.debug.ui.commands.AllReferences"
             name="%ActionDefinition.allReferences.name">
+      </command>
+      <command
+            categoryId="org.eclipse.debug.ui.category.run"
+            description="%ActionDefinition.allInstances.description"
+            id="org.eclipse.jdt.debug.ui.commands.AllInstances"
+            name="%ActionDefinition.allInstances.name">
       </command> 
    </extension>
    <extension point="org.eclipse.ui.bindings">
@@ -2192,6 +2246,12 @@
          schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
          sequence="M1+M2+N">
    </key>
+   <key
+         commandId="org.eclipse.jdt.debug.ui.commands.AllInstances"
+         contextId="org.eclipse.debug.ui.debugging"
+         schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+         sequence="M1+M2+N">
+   </key>
    </extension>
    <extension
          point="org.eclipse.jdt.ui.classpathContainerPage">
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java
index a598e20..7276b18 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaDetailFormattersManager.java
@@ -53,6 +53,7 @@
 import org.eclipse.jdt.debug.eval.IEvaluationResult;
 import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
 import org.eclipse.jdt.internal.debug.core.JavaDebugUtils;
+import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIAllInstancesValue;
 import org.eclipse.jface.util.IPropertyChangeListener;
 import org.eclipse.jface.util.PropertyChangeEvent;
 
@@ -152,6 +153,10 @@
 		if (value instanceof IJavaObject) {
 			IJavaObject objectValue= (IJavaObject) value;
 			try {
+				if(value instanceof JDIAllInstancesValue) {
+					listener.detailComputed(value, ((JDIAllInstancesValue)value).getReferenceTypeName());
+					return;
+				}
 				IJavaDebugTarget debugTarget= (IJavaDebugTarget) thread.getDebugTarget();
 				// get the compiled expression to use
 				Expression expression= getCompiledExpression(objectValue, debugTarget, thread);
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/MemberActionFilter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/MemberActionFilter.java
index 8195de4..dcd45c9 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/MemberActionFilter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/MemberActionFilter.java
@@ -11,12 +11,15 @@
 package org.eclipse.jdt.internal.debug.ui;
 
 
+import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.Platform;
+import org.eclipse.debug.ui.DebugUITools;
 import org.eclipse.jdt.core.Flags;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IMember;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.debug.core.IJavaDebugTarget;
 import org.eclipse.ui.IActionFilter;
 import org.eclipse.ui.IEditorPart;
 import org.eclipse.ui.IWorkbenchPage;
@@ -76,6 +79,16 @@
 						return false;
 					}
 				}
+				if(value.equals("isInstanceRetrievalAvailable")) { //$NON-NLS-1$
+					IAdaptable adapt = DebugUITools.getDebugContext();
+					if(adapt != null) {
+						IJavaDebugTarget adapter = (IJavaDebugTarget) adapt.getAdapter(IJavaDebugTarget.class);
+						if(adapter != null) {
+							return adapter.supportsInstanceRetrieval();
+						}
+					}
+					return false;
+				}
 			}
 		}
 		return false;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllInstancesActionDelegate.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllInstancesActionDelegate.java
new file mode 100644
index 0000000..d143136
--- /dev/null
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/heapwalking/AllInstancesActionDelegate.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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
+ *******************************************************************************/
+package org.eclipse.jdt.internal.debug.ui.heapwalking;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.ui.IDebugView;
+import org.eclipse.debug.ui.InspectPopupDialog;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIAllInstancesValue;
+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
+import org.eclipse.jdt.internal.debug.core.model.JDIReferenceType;
+import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
+import org.eclipse.jdt.internal.debug.ui.actions.ObjectActionDelegate;
+import org.eclipse.jdt.internal.debug.ui.display.JavaInspectExpression;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * Class to provide new function of viewing all live objects of the selected type in the current VM
+ * New feature of 1.6 Mustang VMs
+ * 
+ * @since 3.3
+ *
+ */
+public class AllInstancesActionDelegate extends ObjectActionDelegate implements IEditorActionDelegate {
+
+	public static final String ACTION_ID = JDIDebugUIPlugin.getUniqueIdentifier() + ".all_instances"; //$NON-NLS-1$
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	public void run(IAction action) {
+		IStructuredSelection currentSelection = getCurrentSelection();
+		IJavaVariable var = (IJavaVariable) currentSelection.getFirstElement();
+		try {
+			IJavaType type = var.getJavaType();
+			if(type instanceof JDIReferenceType) {
+				JDIReferenceType rtype = (JDIReferenceType) type;
+				JDIAllInstancesValue aiv = new JDIAllInstancesValue((JDIDebugTarget) type.getDebugTarget(), rtype.getInstances(0));
+				InspectPopupDialog ipd = new InspectPopupDialog(getWorkbenchWindow().getShell(), 
+						getAnchor((IDebugView) getPart().getAdapter(IDebugView.class)), 
+						ACTION_ID, 
+						new JavaInspectExpression(var.getName(), aiv)/*new JavaObjectCollection(rtype.getInstances(0), (IJavaDebugTarget) type.getDebugTarget()))*/);
+				ipd.open();
+			}
+		} catch (DebugException e) {}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
+	 */
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {}
+	
+	/**
+	 * Compute an anchor based on selected item in the tree.
+	 * 
+	 * @param view anchor view
+	 * @return anchor point
+	 */
+    protected Point getAnchor(IDebugView view) {
+		Control control = view.getViewer().getControl();
+		if (control instanceof Tree) {
+			Tree tree = (Tree) control;
+			TreeItem[] selection = tree.getSelection();
+			if (selection.length > 0) {
+				Rectangle bounds = selection[0].getBounds();
+				return tree.toDisplay(new Point(bounds.x, bounds.y + bounds.height));
+			}
+		}
+		return control.toDisplay(0, 0);    	
+    }
+}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIAllInstancesValue.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIAllInstancesValue.java
new file mode 100644
index 0000000..b8408dc
--- /dev/null
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/JDIAllInstancesValue.java
@@ -0,0 +1,179 @@
+package org.eclipse.jdt.internal.debug.core.logicalstructures;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaArrayType;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.internal.debug.core.model.JDIArrayValue;
+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
+
+import com.sun.jdi.Value;
+
+public class JDIAllInstancesValue extends JDIArrayValue {
+
+	private IJavaObject[] fElements = null;
+	private IJavaArrayType fType = null;
+	
+	/**
+	 * Constructor
+	 * @param target the target VM
+	 * @param value the underlying ArrayReference
+	 * @param values the values to set in the array
+	 */
+	public JDIAllInstancesValue(JDIDebugTarget target, IJavaObject[] values) {
+		super(target, null);
+		fElements = values;
+		try {
+			IJavaType[] javaTypes = target.getJavaTypes("java.lang.Object[]"); //$NON-NLS-1$
+			if (javaTypes.length > 0) {
+				fType = (IJavaArrayType) javaTypes[0];
+			}
+		} catch (DebugException e) {}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getLength()
+	 */
+	public synchronized int getLength() throws DebugException {
+		return (fElements != null ? fElements.length : 0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getSize()
+	 */
+	public int getSize() throws DebugException {
+		return (fElements != null ? fElements.length : 0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getValue(int)
+	 */
+	public IJavaValue getValue(int index) throws DebugException {
+		if(fElements != null) {
+			if(index > fElements.length-1 || index < 0) {
+				internalError(LogicalStructuresMessages.JDIAllInstancesValue_0);
+			}
+			return fElements[index];
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getValues()
+	 */
+	public IJavaValue[] getValues() throws DebugException {
+		return fElements;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getVariable(int)
+	 */
+	public IVariable getVariable(int offset) throws DebugException {
+		if(fElements != null) {
+			if(offset > fElements.length-1 || offset < 0) {
+				internalError(LogicalStructuresMessages.JDIAllInstancesValue_1);
+			}
+			return new JDIPlaceholderVariable("[" + offset + "]", fElements[offset]); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		internalError(LogicalStructuresMessages.JDIAllInstancesValue_2);
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getVariables(int, int)
+	 */
+	public IVariable[] getVariables(int offset, int length) throws DebugException {
+		if(fElements != null) {
+			if(offset > fElements.length-1 || offset < 0) {
+				internalError(LogicalStructuresMessages.JDIAllInstancesValue_1);
+			}
+			IVariable[] vars = new JDIPlaceholderVariable[length];
+			for (int i = 0; i < length; i++) {
+				vars[i] = getVariable(i + offset);
+			}
+			return vars;
+		}
+		internalError(LogicalStructuresMessages.JDIAllInstancesValue_2);
+		return null;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIValue#getVariables()
+	 */
+	public IVariable[] getVariables() throws DebugException {
+		return getVariables(0, fElements.length);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIObjectValue#getReferringObjects(long)
+	 */
+	public IJavaObject[] getReferringObjects(long max) throws DebugException {
+		return new IJavaObject[0];
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIValue#isAllocated()
+	 */
+	public boolean isAllocated() throws DebugException {
+		return getJavaDebugTarget().isAvailable();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#getInitialOffset()
+	 */
+	public int getInitialOffset() {
+		return 0;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIArrayValue#hasVariables()
+	 */
+	public boolean hasVariables() throws DebugException {
+		return (fElements != null ? fElements.length > 0 : false);
+	}	
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIValue#getJavaType()
+	 */
+	public IJavaType getJavaType() throws DebugException {
+		return fType;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIValue#getSignature()
+	 */
+	public String getSignature() throws DebugException {
+		return fType.getSignature();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIObjectValue#getReferenceTypeName()
+	 */
+	public String getReferenceTypeName() throws DebugException {
+		return fType.getName();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jdt.internal.debug.core.model.JDIValue#getValueString()
+	 */
+	public String getValueString() throws DebugException {
+		StringBuffer buf = new StringBuffer();
+		buf.append("["); //$NON-NLS-1$
+		for (int i = 0; i < fElements.length; i++) {
+			buf.append(fElements[i].getValueString());
+			if (i < (fElements.length - 1)) {
+				buf.append(", "); //$NON-NLS-1$
+			}
+		}
+		buf.append("]"); //$NON-NLS-1$
+		return buf.toString();
+	}
+
+	protected Value getUnderlyingValue() {
+		// TODO Auto-generated method stub
+		return super.getUnderlyingValue();
+	}
+	
+}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.java
index f465deb..f5f5a8f 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.java
@@ -14,6 +14,12 @@
 public class LogicalStructuresMessages extends NLS {
 	private static final String BUNDLE_NAME = "org.eclipse.jdt.internal.debug.core.logicalstructures.LogicalStructuresMessages";//$NON-NLS-1$
 
+	public static String JDIAllInstancesValue_0;
+
+	public static String JDIAllInstancesValue_1;
+
+	public static String JDIAllInstancesValue_2;
+
 	public static String LogicalObjectStructureType_1;
 	public static String JavaLogicalStructures_0;
 	public static String JavaLogicalStructures_1;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.properties b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.properties
index e7d4c45..514ab82 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.properties
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/logicalstructures/LogicalStructuresMessages.properties
@@ -20,3 +20,6 @@
 JavaLogicalStructure_1=Java logical structure evaluation failed.
 JavaLogicalStructure_2=Exception occurred: {0}.
 JavaLogicalStructure_3=Internal error(s) occurred. See log for details.
+JDIAllInstancesValue_0=The specified index is outside the range of this array
+JDIAllInstancesValue_1=The specified offset is outside the range of this collection
+JDIAllInstancesValue_2=You cannot get a variable from a null collection