Search in sources :

Example 16 with DebuggerContextImpl

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);
                    }
                }
            }
        });
    }
}
Also used : JavaValue(com.intellij.debugger.engine.JavaValue) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) XValue(com.intellij.xdebugger.frame.XValue) Project(com.intellij.openapi.project.Project) ValueDescriptorImpl(com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) XValueNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

Example 17 with DebuggerContextImpl

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);
                }
            });
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) DebuggerCommandImpl(com.intellij.debugger.engine.events.DebuggerCommandImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) List(java.util.List) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

Example 18 with DebuggerContextImpl

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());
            }
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) StackFrameProxyImpl(com.intellij.debugger.jdi.StackFrameProxyImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) JavaStackFrame(com.intellij.debugger.engine.JavaStackFrame) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) Method(com.sun.jdi.Method) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Example 19 with DebuggerContextImpl

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();
                }
            });
        }
    }
}
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) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) ThreadReferenceProxyImpl(com.intellij.debugger.jdi.ThreadReferenceProxyImpl)

Example 20 with DebuggerContextImpl

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;
    }
}
Also used : ValueDescriptor(com.intellij.debugger.ui.tree.ValueDescriptor) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) ValueMarkup(com.intellij.xdebugger.impl.ui.tree.ValueMarkup)

Aggregations

DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)42 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)20 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)12 Project (com.intellij.openapi.project.Project)12 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)11 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)11 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)10 JavaValue (com.intellij.debugger.engine.JavaValue)9 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)8 NotNull (org.jetbrains.annotations.NotNull)7 EvaluationContextImpl (com.intellij.debugger.engine.evaluation.EvaluationContextImpl)6 SourcePosition (com.intellij.debugger.SourcePosition)5 JavaValueModifier (com.intellij.debugger.engine.JavaValueModifier)5 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)5 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)5 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)4 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)4 List (java.util.List)4 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)3 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)3