[r301] Bug 70373 - Make "Drop to Frame" action available in the context menu for IJavaStackFrame adapters
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DropToFrameAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DropToFrameAction.java
index bd6628d..e0d1329 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DropToFrameAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/DropToFrameAction.java
@@ -14,6 +14,7 @@
import java.util.Iterator;
import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.jdt.debug.core.IJavaStackFrame;
import org.eclipse.jdt.internal.debug.ui.ExceptionHandler;
import org.eclipse.jface.action.IAction;
@@ -32,13 +33,16 @@
Iterator itr= selection.iterator();
while (itr.hasNext()) {
- IJavaStackFrame frame= (IJavaStackFrame)itr.next();
- try {
- frame.dropToFrame();
- } catch (DebugException de) {
- String title= ActionMessages.getString("DropToFrameAction.Drop_to_Frame_1"); //$NON-NLS-1$
- String message= ActionMessages.getString("DropToFrameAction.Exceptions_occurred_attempting_to_drop_to_frame._2"); //$NON-NLS-1$
- ExceptionHandler.handle(de, title, message);
+ IStackFrame frame= (IStackFrame)itr.next();
+ IJavaStackFrame stackFrame = (IJavaStackFrame)frame.getAdapter(IJavaStackFrame.class);
+ if (stackFrame != null) {
+ try {
+ stackFrame.dropToFrame();
+ } catch (DebugException de) {
+ String title= ActionMessages.getString("DropToFrameAction.Drop_to_Frame_1"); //$NON-NLS-1$
+ String message= ActionMessages.getString("DropToFrameAction.Exceptions_occurred_attempting_to_drop_to_frame._2"); //$NON-NLS-1$
+ ExceptionHandler.handle(de, title, message);
+ }
}
}
}