use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.
the class JumpToObjectAction method update.
@Override
public void update(final AnActionEvent e) {
if (!isFirstStart(e)) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
e.getPresentation().setVisible(false);
return;
}
DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if (selectedNode == null) {
e.getPresentation().setVisible(false);
return;
}
final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
if (descriptor instanceof ValueDescriptor) {
debugProcess.getManagerThread().schedule(new EnableCommand(debuggerContext, (ValueDescriptor) descriptor, debugProcess, e));
} else {
e.getPresentation().setVisible(false);
}
}
use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.
the class EditSourceAction method getSourcePosition.
private static SourcePosition getSourcePosition(DebuggerTreeNodeImpl selectedNode, DebuggerContextImpl debuggerContext) {
final DebuggerContextImpl context = debuggerContext;
if (selectedNode == null || context == null) {
return null;
}
final Project project = selectedNode.getProject();
final DebuggerSession debuggerSession = context.getDebuggerSession();
if (debuggerSession == null) {
return null;
}
NodeDescriptorImpl nodeDescriptor = selectedNode.getDescriptor();
if (nodeDescriptor instanceof WatchItemDescriptor) {
Modifier modifier = ((WatchItemDescriptor) nodeDescriptor).getModifier();
if (modifier == null) {
return null;
}
nodeDescriptor = (NodeDescriptorImpl) modifier.getInspectItem(project);
}
final NodeDescriptorImpl nodeDescriptor1 = nodeDescriptor;
return ApplicationManager.getApplication().runReadAction(new Computable<SourcePosition>() {
public SourcePosition compute() {
return SourcePositionProvider.getSourcePosition(nodeDescriptor1, project, context);
}
});
}
use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl in project intellij-community by JetBrains.
the class AdjustArrayRangeAction method createNodeTitle.
private static String createNodeTitle(String prefix, DebuggerTreeNodeImpl node) {
if (node != null) {
DebuggerTreeNodeImpl parent = node.getParent();
NodeDescriptorImpl descriptor = parent.getDescriptor();
if (descriptor instanceof ValueDescriptorImpl && ((ValueDescriptorImpl) descriptor).isArray()) {
int index = parent.getIndex(node);
return createNodeTitle(prefix, parent) + "[" + index + "]";
}
String name = (node.getDescriptor() != null) ? node.getDescriptor().getName() : null;
return (name != null) ? prefix + " " + name : prefix;
}
return prefix;
}
use of com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl 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.NodeDescriptorImpl 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);
}
}
});
}
}
}
Aggregations