use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class EditSourceAction method update.
public void update(AnActionEvent e) {
final Project project = e.getProject();
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebuggerTreeNodeImpl node = getSelectedNode(e.getDataContext());
final Presentation presentation = e.getPresentation();
if (debuggerContext.getDebugProcess() != null) {
presentation.setEnabled(true);
debuggerContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition position = getSourcePosition(node, debuggerContext);
if (position == null) {
DebuggerInvocationUtil.swingInvokeLater(project, () -> presentation.setEnabled(false));
}
}
});
} else {
presentation.setEnabled(false);
}
e.getPresentation().setText(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getTemplatePresentation().getText());
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class EditSourceAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null) {
return;
}
final DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
if (selectedNode != null) {
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
DebugProcessImpl process = debuggerContext.getDebugProcess();
if (process != null) {
process.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {
public void threadAction() {
final SourcePosition sourcePosition = getSourcePosition(selectedNode, debuggerContext);
if (sourcePosition != null) {
sourcePosition.navigate(true);
}
}
});
}
}
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl 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.DebuggerTreeNodeImpl in project intellij-community by JetBrains.
the class JavaMarkObjectActionHandler method isMarked.
@Override
public boolean isMarked(@NotNull Project project, @NotNull AnActionEvent event) {
final DebuggerTreeNodeImpl node = DebuggerAction.getSelectedNode(event.getDataContext());
if (node == null)
return false;
final NodeDescriptorImpl descriptor = node.getDescriptor();
if (!(descriptor instanceof ValueDescriptor))
return false;
DebugProcess debugProcess = node.getTree().getDebuggerContext().getDebugProcess();
return ((ValueDescriptor) descriptor).getMarkup(debugProcess) != null;
}
use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl 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