Search in sources :

Example 6 with ThreadDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.

the class ResumeThreadAction method update.

public void update(AnActionEvent e) {
    DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
    boolean visible = false;
    boolean enabled = false;
    String text = DebuggerBundle.message("action.resume.thread.text.resume");
    if (selectedNodes != null && selectedNodes.length > 0) {
        visible = true;
        enabled = true;
        for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
            final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
            if (!(threadDescriptor instanceof ThreadDescriptorImpl) || !((ThreadDescriptorImpl) threadDescriptor).isSuspended()) {
                visible = false;
                break;
            }
        }
    }
    final Presentation presentation = e.getPresentation();
    presentation.setText(text);
    presentation.setVisible(visible);
    presentation.setEnabled(enabled);
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) ThreadDescriptorImpl(com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl) Presentation(com.intellij.openapi.actionSystem.Presentation) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 7 with ThreadDescriptorImpl

use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.

the class ResumeThreadAction method actionPerformed.

public void actionPerformed(final AnActionEvent e) {
    DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
    final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null)
        return;
    //noinspection ConstantConditions
    for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
        final ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
        if (threadDescriptor.isSuspended()) {
            final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
            debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {

                @Override
                protected void action() throws Exception {
                    SuspendContextImpl suspendingContext = SuspendManagerUtil.getSuspendingContext(debugProcess.getSuspendManager(), thread);
                    if (suspendingContext != null) {
                        debugProcess.createResumeThreadCommand(suspendingContext, thread).run();
                    }
                    debuggerTreeNode.calcValue();
                }
            });
        }
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) ThreadDescriptorImpl(com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl)

Aggregations

DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)7 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)7 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)4 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)4 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)4 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)3 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)3 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 Presentation (com.intellij.openapi.actionSystem.Presentation)2 StackFrameDescriptorImpl (com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl)1 Project (com.intellij.openapi.project.Project)1 ArrayList (java.util.ArrayList)1