Skip to content

Commit 0d7bb27

Browse files
committed
Add ISourceLookup adapter to GroupedStackFrame
1 parent 04eb91d commit 0d7bb27

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIDebugUIPlugin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import org.eclipse.jdt.debug.core.IJavaVariable;
5858
import org.eclipse.jdt.debug.core.JDIDebugModel;
5959
import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants;
60+
import org.eclipse.jdt.internal.debug.core.model.GroupedStackFrame;
6061
import org.eclipse.jdt.internal.debug.ui.breakpoints.ExceptionInspector;
6162
import org.eclipse.jdt.internal.debug.ui.breakpoints.JavaBreakpointTypeAdapterFactory;
6263
import org.eclipse.jdt.internal.debug.ui.classpath.ClasspathEntryAdapterFactory;
@@ -393,6 +394,7 @@ public void start(BundleContext context) throws Exception {
393394

394395
IAdapterFactory showInFactory = new JavaDebugShowInAdapterFactory();
395396
manager.registerAdapters(showInFactory, IJavaStackFrame.class);
397+
manager.registerAdapters(showInFactory, GroupedStackFrame.class);
396398

397399
IAdapterFactory columnFactory = new ColumnPresentationAdapterFactory();
398400
manager.registerAdapters(columnFactory, IJavaVariable.class);

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/sourcelookup/JavaDebugShowInAdapterFactory.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
package org.eclipse.jdt.internal.debug.ui.sourcelookup;
1515

1616
import org.eclipse.core.runtime.IAdapterFactory;
17+
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
18+
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
1719
import org.eclipse.jdt.debug.core.IJavaStackFrame;
20+
import org.eclipse.jdt.internal.debug.core.model.GroupedStackFrame;
1821
import org.eclipse.ui.part.IShowInSource;
1922
import org.eclipse.ui.part.IShowInTargetList;
2023

@@ -41,6 +44,15 @@ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
4144
return (T) new StackFrameShowInTargetListAdapter();
4245
}
4346
}
47+
if (adapterType == ISourceDisplay.class) {
48+
if (adaptableObject instanceof GroupedStackFrame) {
49+
return (T) (ISourceDisplay) (element, page, forceSourceLookup) -> {
50+
var frame = ((GroupedStackFrame) element).getTopMostFrame();
51+
SourceLookupFacility.getDefault().displaySource(frame, page, forceSourceLookup);
52+
};
53+
}
54+
55+
}
4456
return null;
4557
}
4658

@@ -49,7 +61,7 @@ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
4961
*/
5062
@Override
5163
public Class<?>[] getAdapterList() {
52-
return new Class[]{IShowInSource.class, IShowInTargetList.class};
64+
return new Class[] { IShowInSource.class, IShowInTargetList.class, ISourceDisplay.class };
5365
}
5466

5567
}

org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/GroupedStackFrame.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ public Object[] getFramesAsArray() {
4141
return stackFrames.toArray();
4242
}
4343

44+
public IJavaStackFrame getTopMostFrame() {
45+
return !stackFrames.isEmpty() ? stackFrames.get(0) : null;
46+
}
47+
4448
/**
4549
* Delegates actions, and everything to the top most stack frame.
4650
*/

0 commit comments

Comments
 (0)