Search in sources :

Example 11 with EvaluationContextImpl

use of com.intellij.debugger.engine.evaluation.EvaluationContextImpl in project intellij-community by JetBrains.

the class LocalVariableDescriptorImpl method getModifier.

@Override
public XValueModifier getModifier(JavaValue value) {
    return new JavaValueModifier(value) {

        @Override
        protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
            final LocalVariableProxyImpl local = LocalVariableDescriptorImpl.this.getLocalVariable();
            if (local != null) {
                final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
                set(expression, callback, debuggerContext, new SetValueRunnable() {

                    public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                        debuggerContext.getFrameProxy().setValue(local, preprocessValue(evaluationContext, newValue, local.getType()));
                        update(debuggerContext);
                    }

                    public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
                        return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, evaluationContext.getClassLoader());
                    }
                });
            }
        }
    };
}
Also used : LocalVariableProxyImpl(com.intellij.debugger.jdi.LocalVariableProxyImpl) NotNull(org.jetbrains.annotations.NotNull) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) JavaValueModifier(com.intellij.debugger.engine.JavaValueModifier) EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl) JavaValue(com.intellij.debugger.engine.JavaValue) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

Example 12 with EvaluationContextImpl

use of com.intellij.debugger.engine.evaluation.EvaluationContextImpl in project intellij-community by JetBrains.

the class IconObjectRenderer method calcValueIcon.

@Override
public Icon calcValueIcon(final ValueDescriptor descriptor, final EvaluationContext evaluationContext, final DescriptorLabelListener listener) throws EvaluateException {
    EvaluationContextImpl evalContext = ((EvaluationContextImpl) evaluationContext);
    DebugProcessImpl debugProcess = evalContext.getDebugProcess();
    if (!Registry.is("debugger.auto.fetch.icons") || DebuggerUtilsImpl.isRemote(debugProcess))
        return null;
    debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(evalContext.getSuspendContext()) {

        @Override
        public void contextAction() throws Exception {
            String getterName = AllIcons.Debugger.Value.getIconHeight() <= 16 ? "iconToBytesPreviewNormal" : "iconToBytesPreviewRetina";
            descriptor.setValueIcon(ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), getterName));
            listener.labelChanged();
        }
    });
    return null;
}
Also used : EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) SuspendContextCommandImpl(com.intellij.debugger.engine.events.SuspendContextCommandImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException)

Example 13 with EvaluationContextImpl

use of com.intellij.debugger.engine.evaluation.EvaluationContextImpl in project intellij-community by JetBrains.

the class ArgumentValueDescriptorImpl method getModifier.

@Override
public XValueModifier getModifier(JavaValue value) {
    return new JavaValueModifier(value) {

        @Override
        protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
            final DecompiledLocalVariable local = ArgumentValueDescriptorImpl.this.getVariable();
            if (local != null) {
                final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
                set(expression, callback, debuggerContext, new SetValueRunnable() {

                    public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                        LocalVariablesUtil.setValue(debuggerContext.getFrameProxy().getStackFrame(), local.getSlot(), newValue);
                        update(debuggerContext);
                    }

                    public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
                        return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, evaluationContext.getClassLoader());
                    }
                });
            }
        }
    };
}
Also used : DecompiledLocalVariable(com.intellij.debugger.jdi.DecompiledLocalVariable) NotNull(org.jetbrains.annotations.NotNull) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) JavaValueModifier(com.intellij.debugger.engine.JavaValueModifier) EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl) JavaValue(com.intellij.debugger.engine.JavaValue) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl)

Example 14 with EvaluationContextImpl

use of com.intellij.debugger.engine.evaluation.EvaluationContextImpl in project intellij-community by JetBrains.

the class DebuggerTestCase method createEvaluationContext.

protected EvaluationContextImpl createEvaluationContext(final SuspendContextImpl suspendContext) {
    try {
        StackFrameProxyImpl proxy = suspendContext.getFrameProxy();
        assertNotNull(proxy);
        return new EvaluationContextImpl(suspendContext, proxy, proxy.thisObject());
    } catch (EvaluateException e) {
        error(e);
        return null;
    }
}
Also used : StackFrameProxyImpl(com.intellij.debugger.jdi.StackFrameProxyImpl) EvaluateException(com.intellij.debugger.engine.evaluation.EvaluateException) EvaluationContextImpl(com.intellij.debugger.engine.evaluation.EvaluationContextImpl)

Aggregations

EvaluationContextImpl (com.intellij.debugger.engine.evaluation.EvaluationContextImpl)14 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)12 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)7 JavaValue (com.intellij.debugger.engine.JavaValue)6 JavaValueModifier (com.intellij.debugger.engine.JavaValueModifier)6 NotNull (org.jetbrains.annotations.NotNull)6 StackFrameProxyImpl (com.intellij.debugger.jdi.StackFrameProxyImpl)3 SourcePosition (com.intellij.debugger.SourcePosition)2 TextWithImports (com.intellij.debugger.engine.evaluation.TextWithImports)2 Modifier (com.intellij.debugger.engine.evaluation.expression.Modifier)2 SuspendContextCommandImpl (com.intellij.debugger.engine.events.SuspendContextCommandImpl)2 LocalVariableProxyImpl (com.intellij.debugger.jdi.LocalVariableProxyImpl)2 XValueModifier (com.intellij.xdebugger.frame.XValueModifier)2 Nullable (org.jetbrains.annotations.Nullable)2 DebuggerBundle (com.intellij.debugger.DebuggerBundle)1 DebuggerContext (com.intellij.debugger.DebuggerContext)1 DebuggerManagerEx (com.intellij.debugger.DebuggerManagerEx)1 ContextUtil (com.intellij.debugger.engine.ContextUtil)1 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)1 StackFrameContext (com.intellij.debugger.engine.StackFrameContext)1