use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.
the class InterruptThreadAction method update.
public void update(AnActionEvent e) {
final DebuggerTreeNodeImpl[] selectedNodes = getSelectedNodes(e.getDataContext());
boolean visible = false;
boolean enabled = false;
if (selectedNodes != null && selectedNodes.length > 0) {
visible = true;
enabled = true;
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final NodeDescriptorImpl threadDescriptor = selectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl)) {
visible = false;
break;
}
}
if (visible) {
for (DebuggerTreeNodeImpl selectedNode : selectedNodes) {
final ThreadDescriptorImpl threadDescriptor = (ThreadDescriptorImpl) selectedNode.getDescriptor();
if (threadDescriptor.isFrozen() || threadDescriptor.isSuspended()) {
enabled = false;
break;
}
}
}
}
final Presentation presentation = e.getPresentation();
presentation.setText(DebuggerBundle.message("action.interrupt.thread.text"));
presentation.setEnabledAndVisible(visible && enabled);
}
use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method update.
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
DebugProcessImpl debugProcess = getDebuggerContext(e.getDataContext()).getDebugProcess();
boolean visible = false;
if (debugProcess != null) {
visible = true;
for (DebuggerTreeNodeImpl aSelectedNode : selectedNode) {
NodeDescriptorImpl threadDescriptor = aSelectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || ((ThreadDescriptorImpl) threadDescriptor).isSuspended()) {
visible = false;
break;
}
}
}
e.getPresentation().setVisible(visible);
}
use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.
the class FreezeThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
if (!threadDescriptor.isFrozen()) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.
the class InterruptThreadAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final DebuggerTreeNodeImpl[] nodes = getSelectedNodes(e.getDataContext());
if (nodes == null) {
return;
}
//noinspection ConstantConditions
final List<ThreadReferenceProxyImpl> threadsToInterrupt = new ArrayList<>();
for (final DebuggerTreeNodeImpl debuggerTreeNode : nodes) {
final NodeDescriptorImpl descriptor = debuggerTreeNode.getDescriptor();
if (descriptor instanceof ThreadDescriptorImpl) {
threadsToInterrupt.add(((ThreadDescriptorImpl) descriptor).getThreadReference());
}
}
if (!threadsToInterrupt.isEmpty()) {
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess != null) {
debugProcess.getManagerThread().schedule(new DebuggerCommandImpl() {
protected void action() throws Exception {
boolean unsupported = false;
for (ThreadReferenceProxyImpl thread : threadsToInterrupt) {
try {
thread.getThreadReference().interrupt();
} catch (UnsupportedOperationException ignored) {
unsupported = true;
}
}
if (unsupported) {
final Project project = debugProcess.getProject();
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification("Thread operation 'interrupt' is not supported by VM", MessageType.INFO).notify(project);
}
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl in project intellij-community by JetBrains.
the class PopFrameAction method isAtBreakpoint.
private static boolean isAtBreakpoint(AnActionEvent e) {
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if (selectedNode != null && selectedNode.getDescriptor() instanceof StackFrameDescriptorImpl) {
DebuggerTreeNodeImpl parent = selectedNode.getParent();
if (parent != null) {
return ((ThreadDescriptorImpl) parent.getDescriptor()).isAtBreakpoint();
}
}
DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
SuspendContextImpl suspendContext = debuggerContext.getSuspendContext();
return suspendContext != null && debuggerContext.getThreadProxy() == suspendContext.getThread();
}
Aggregations