import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.jdi.StackFrameProxyImpl;
import com.intellij.debugger.settings.DebuggerSettings;
-import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
-import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl;
-import com.intellij.debugger.ui.tree.ThreadDescriptor;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.application.ApplicationManager;
if (process == null) {
return;
}
- final StackFrameDescriptorImpl descriptor = PopFrameAction.getSelectedStackFrameDescriptor(e);
+ final StackFrameProxyImpl proxy = PopFrameAction.getStackFrameProxy(e);
process.getManagerThread().schedule(new DebuggerCommandImpl() {
protected void action() throws Exception {
- final String name = getClassName(descriptor != null ? descriptor.getFrameProxy() : debuggerContext.getFrameProxy());
+ final String name = getClassName(proxy != null ? proxy : debuggerContext.getFrameProxy());
if (name == null) {
return;
}
}
public void update(AnActionEvent e) {
- DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
- if (selectedNode != null && selectedNode.getDescriptor() instanceof ThreadDescriptor) {
- e.getPresentation().setEnabledAndVisible(false);
- }
- else {
- e.getPresentation().setEnabledAndVisible(true);
- }
+ e.getPresentation().setEnabledAndVisible(PopFrameAction.getStackFrameProxy(e) != null);
}
private static String getClassName(StackFrameProxyImpl stackFrameProxy) {
}
return new JavaStackFrame(descriptor, false);
}
- return getSelectedStackFrame(e);
+ JavaStackFrame frame = getSelectedStackFrame(e);
+ if (frame != null) {
+ StackFrameProxyImpl proxy = frame.getStackFrameProxy();
+ if (proxy == null || proxy.isBottom()) return null;
+ return frame;
+ }
+ return null;
}
- private static StackFrameProxyImpl getStackFrameProxy(AnActionEvent e) {
- StackFrameDescriptorImpl descriptor = getSelectedStackFrameDescriptor(e);
- if (descriptor != null) {
- if (descriptor.getFrameProxy().isBottom()) {
- return null;
+ static StackFrameProxyImpl getStackFrameProxy(AnActionEvent e) {
+ DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
+ if (node != null) {
+ NodeDescriptorImpl descriptor = node.getDescriptor();
+ if (descriptor instanceof StackFrameDescriptorImpl) {
+ return ((StackFrameDescriptorImpl)descriptor).getFrameProxy();
}
- return descriptor.getFrameProxy();
}
else {
JavaStackFrame stackFrame = getSelectedStackFrame(e);
}
@Nullable
- static StackFrameDescriptorImpl getSelectedStackFrameDescriptor(AnActionEvent e) {
+ private static StackFrameDescriptorImpl getSelectedStackFrameDescriptor(AnActionEvent e) {
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if(selectedNode != null) {
NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
if (session != null) {
XStackFrame frame = session.getCurrentStackFrame();
if (frame instanceof JavaStackFrame) {
- StackFrameProxyImpl proxy = ((JavaStackFrame)frame).getStackFrameProxy();
- return !proxy.isBottom() ? ((JavaStackFrame)frame) : null;
+ return ((JavaStackFrame)frame);
}
}
}
boolean enable = false;
StackFrameProxyImpl proxy = getStackFrameProxy(e);
- if (proxy != null && isAtBreakpoint(e)) {
+ if (proxy != null && !proxy.isBottom() && isAtBreakpoint(e)) {
enable = proxy.getVirtualMachine().canPopFrames();
}