Search in sources :

Example 6 with DebuggerContextCommandImpl

use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl 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 7 with DebuggerContextCommandImpl

use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.

the class DebuggerTreeNodeImpl method update.

private void update(final DebuggerContextImpl context, final Runnable runnable, boolean labelOnly) {
    if (!labelOnly) {
        clear();
    }
    if (context != null && context.getDebugProcess() != null) {
        getTree().saveState(this);
        myIcon = DebuggerTreeRenderer.getDescriptorIcon(MessageDescriptor.EVALUATING);
        myText = DebuggerTreeRenderer.getDescriptorText(context, MessageDescriptor.EVALUATING, false);
        context.getDebugProcess().getManagerThread().invoke(new DebuggerContextCommandImpl(context) {

            @Override
            public void threadAction() {
                runnable.run();
            }

            @Override
            protected void commandCancelled() {
                clear();
                getDescriptor().clear();
                updateCaches();
                labelChanged();
                childrenChanged(true);
            }

            @Override
            public Priority getPriority() {
                return Priority.NORMAL;
            }
        });
    }
    labelChanged();
    if (!labelOnly) {
        childrenChanged(true);
    }
}
Also used : DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Example 8 with DebuggerContextCommandImpl

use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl 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());
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) SourcePosition(com.intellij.debugger.SourcePosition) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) Presentation(com.intellij.openapi.actionSystem.Presentation) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Example 9 with DebuggerContextCommandImpl

use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl 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);
                    }
                }
            });
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) SourcePosition(com.intellij.debugger.SourcePosition) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Example 10 with DebuggerContextCommandImpl

use of com.intellij.debugger.engine.events.DebuggerContextCommandImpl in project intellij-community by JetBrains.

the class AutoRendererAction method actionPerformed.

public void actionPerformed(@NotNull final AnActionEvent e) {
    final DebuggerContextImpl debuggerContext = DebuggerAction.getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess != null) {
        final List<JavaValue> selectedValues = ViewAsGroup.getSelectedValues(e);
        if (!selectedValues.isEmpty()) {
            debugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(debuggerContext) {

                public void threadAction() {
                    for (JavaValue selectedValue : selectedValues) {
                        selectedValue.getDescriptor().setRenderer(null);
                    }
                    DebuggerAction.refreshViews(e);
                }
            });
        }
    }
}
Also used : DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) JavaValue(com.intellij.debugger.engine.JavaValue) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) DebuggerContextCommandImpl(com.intellij.debugger.engine.events.DebuggerContextCommandImpl)

Aggregations

DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)12 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)10 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)7 Project (com.intellij.openapi.project.Project)6 DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)5 SourcePosition (com.intellij.debugger.SourcePosition)4 JavaValue (com.intellij.debugger.engine.JavaValue)3 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)3 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)2 DebuggerTree (com.intellij.debugger.ui.impl.watch.DebuggerTree)2 Ref (com.intellij.openapi.util.Ref)2 NotNull (org.jetbrains.annotations.NotNull)2 EvaluatingComputable (com.intellij.debugger.EvaluatingComputable)1 JavaStackFrame (com.intellij.debugger.engine.JavaStackFrame)1 TextWithImports (com.intellij.debugger.engine.evaluation.TextWithImports)1 ExpressionEvaluator (com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator)1 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)1 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)1 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)1 NodeRendererSettings (com.intellij.debugger.settings.NodeRendererSettings)1