use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class AdjustArrayRangeAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
return;
}
final Project project = debuggerContext.getProject();
final XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(e.getDataContext());
if (node == null) {
return;
}
final XValue container = node.getValueContainer();
if (!(container instanceof JavaValue)) {
return;
}
final ValueDescriptorImpl descriptor = ((JavaValue) container).getDescriptor();
ArrayRenderer renderer = getArrayRenderer(descriptor);
if (renderer == null) {
return;
}
//String title = createNodeTitle("", selectedNode);
//String label = selectedNode.toString();
//int index = label.indexOf('=');
//if (index > 0) {
// title = title + " " + label.substring(index);
//}
String title = node.getName();
final ArrayRenderer clonedRenderer = renderer.clone();
clonedRenderer.setForced(true);
if (ShowSettingsUtil.getInstance().editConfigurable(project, new NamedArrayConfigurable(title, clonedRenderer))) {
debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(debuggerContext.getSuspendContext()) {
@Override
public void contextAction() throws Exception {
final Renderer lastRenderer = descriptor.getLastRenderer();
if (lastRenderer instanceof ArrayRenderer) {
((JavaValue) container).setRenderer(clonedRenderer, node);
} else if (lastRenderer instanceof CompoundNodeRenderer) {
final CompoundNodeRenderer compoundRenderer = (CompoundNodeRenderer) lastRenderer;
final ChildrenRenderer childrenRenderer = compoundRenderer.getChildrenRenderer();
if (childrenRenderer instanceof ExpressionChildrenRenderer) {
ExpressionChildrenRenderer.setPreferableChildrenRenderer(descriptor, clonedRenderer);
((JavaValue) container).reBuild(node);
}
}
}
});
}
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class ExportThreadsAction method actionPerformed.
public void actionPerformed(AnActionEvent e) {
final Project project = e.getProject();
if (project == null) {
return;
}
DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();
final DebuggerSession session = context.getDebuggerSession();
if (session != null && session.isAttached()) {
final DebugProcessImpl process = context.getDebugProcess();
if (process != null) {
process.getManagerThread().invoke(new DebuggerCommandImpl() {
protected void action() throws Exception {
final List<ThreadState> threads = ThreadDumpAction.buildThreadStates(process.getVirtualMachineProxy());
ApplicationManager.getApplication().invokeLater(() -> ExportToTextFileAction.export(project, ThreadDumpPanel.createToFileExporter(project, threads)), ModalityState.NON_MODAL);
}
});
}
}
}
use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class ForceEarlyReturnAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getProject();
final JavaStackFrame stackFrame = PopFrameAction.getStackFrame(e);
if (stackFrame == null || project == null) {
return;
}
final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
if (debugProcess == null) {
return;
}
final StackFrameProxyImpl proxy = stackFrame.getStackFrameProxy();
final ThreadReferenceProxyImpl thread = proxy.threadProxy();
debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext, thread) {
@Override
public void threadAction() {
Method method;
try {
method = proxy.location().method();
} catch (EvaluateException e) {
showError(project, DebuggerBundle.message("error.early.return", e.getLocalizedMessage()));
return;
}
if ("void".equals(method.returnTypeName())) {
forceEarlyReturnWithFinally(thread.getVirtualMachine().mirrorOfVoid(), stackFrame, debugProcess, null);
} else {
ApplicationManager.getApplication().invokeLater(() -> new ReturnExpressionDialog(project, debugProcess.getXdebugProcess().getEditorsProvider(), debugProcess, stackFrame).show());
}
}
});
}
use of com.intellij.debugger.impl.DebuggerContextImpl 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.impl.DebuggerContextImpl in project intellij-community by JetBrains.
the class DebuggerTreeNodeImpl method updateCaches.
private void updateCaches() {
final NodeDescriptorImpl descriptor = getDescriptor();
myIcon = DebuggerTreeRenderer.getDescriptorIcon(descriptor);
final DebuggerContextImpl context = getTree().getDebuggerContext();
myText = DebuggerTreeRenderer.getDescriptorText(context, descriptor, DebuggerUIUtil.getColorScheme(myTree), false);
if (descriptor instanceof ValueDescriptor) {
final ValueMarkup markup = ((ValueDescriptor) descriptor).getMarkup(context.getDebugProcess());
myMarkupTooltipText = markup != null ? markup.getToolTipText() : null;
} else {
myMarkupTooltipText = null;
}
}
Aggregations