Search in sources :

Example 21 with DebuggerContextImpl

use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.

the class DebuggerTreeNodeImpl method calcLabel.

public void calcLabel() {
    final DebuggerContextImpl context = getTree().getDebuggerContext();
    update(context, () -> getDescriptor().updateRepresentation(context.createEvaluationContext(), new DescriptorLabelListener() {

        @Override
        public void labelChanged() {
            updateCaches();
            DebuggerTreeNodeImpl.this.labelChanged();
        }
    }), true);
}
Also used : DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) DescriptorLabelListener(com.intellij.debugger.ui.tree.render.DescriptorLabelListener)

Example 22 with DebuggerContextImpl

use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.

the class EvaluationDescriptor method getModifier.

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

        @Override
        protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
            final EvaluationDescriptor evaluationDescriptor = EvaluationDescriptor.this;
            if (evaluationDescriptor.canSetValue()) {
                final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
                set(expression, callback, debuggerContext, new SetValueRunnable() {

                    public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                        final Modifier modifier = evaluationDescriptor.getModifier();
                        modifier.setValue(preprocessValue(evaluationContext, newValue, modifier.getExpectedType()));
                        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 : 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) Modifier(com.intellij.debugger.engine.evaluation.expression.Modifier) XValueModifier(com.intellij.xdebugger.frame.XValueModifier) JavaValueModifier(com.intellij.debugger.engine.JavaValueModifier)

Example 23 with DebuggerContextImpl

use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.

the class FieldDescriptorImpl method getModifier.

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

        @Override
        protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
            final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
            FieldDescriptorImpl fieldDescriptor = FieldDescriptorImpl.this;
            final Field field = fieldDescriptor.getField();
            if (!field.isStatic()) {
                final ObjectReference object = fieldDescriptor.getObject();
                if (object != null) {
                    set(expression, callback, debuggerContext, new SetValueRunnable() {

                        public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                            object.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
                            update(debuggerContext);
                        }

                        public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
                            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
                        }
                    });
                }
            } else {
                // field is static
                ReferenceType refType = field.declaringType();
                if (refType instanceof ClassType) {
                    final ClassType classType = (ClassType) refType;
                    set(expression, callback, debuggerContext, new SetValueRunnable() {

                        public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                            classType.setValue(field, preprocessValue(evaluationContext, newValue, field.type()));
                            update(debuggerContext);
                        }

                        public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
                            return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, field.declaringType().classLoader());
                        }
                    });
                }
            }
        }
    };
}
Also used : 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 24 with DebuggerContextImpl

use of com.intellij.debugger.impl.DebuggerContextImpl in project intellij-community by JetBrains.

the class ArrayElementDescriptorImpl method getModifier.

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

        @Override
        protected void setValueImpl(@NotNull String expression, @NotNull XModificationCallback callback) {
            final ArrayElementDescriptorImpl elementDescriptor = ArrayElementDescriptorImpl.this;
            final ArrayReference array = elementDescriptor.getArray();
            if (array != null) {
                if (VirtualMachineProxyImpl.isCollected(array)) {
                    // will only be the case if debugger does not use ObjectReference.disableCollection() because of Patches.IBM_JDK_DISABLE_COLLECTION_BUG
                    Messages.showWarningDialog(getProject(), DebuggerBundle.message("evaluation.error.array.collected") + "\n" + DebuggerBundle.message("warning.recalculate"), DebuggerBundle.message("title.set.value"));
                    //node.getParent().calcValue();
                    return;
                }
                final ArrayType arrType = (ArrayType) array.referenceType();
                final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
                set(expression, callback, debuggerContext, new SetValueRunnable() {

                    public void setValue(EvaluationContextImpl evaluationContext, Value newValue) throws ClassNotLoadedException, InvalidTypeException, EvaluateException {
                        array.setValue(elementDescriptor.getIndex(), preprocessValue(evaluationContext, newValue, arrType.componentType()));
                        update(debuggerContext);
                    }

                    public ReferenceType loadClass(EvaluationContextImpl evaluationContext, String className) throws InvocationException, ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException, EvaluateException {
                        return evaluationContext.getDebugProcess().loadClass(evaluationContext, className, arrType.classLoader());
                    }
                });
            }
        }
    };
}
Also used : 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 25 with DebuggerContextImpl

use of com.intellij.debugger.impl.DebuggerContextImpl in project android by JetBrains.

the class ResolveTypedIntegerCommand method action.

@Override
public void action() {
    // TODO: see if it is possible to cache this evaluation
    // if (myIsEvaluated) return;
    DebugProcess debugProcess = myEvaluationContext.getDebugProcess();
    if (!(debugProcess instanceof DebugProcessImpl)) {
        return;
    }
    final DebuggerContextImpl debuggerContext = ((DebugProcessImpl) debugProcess).getDebuggerContext();
    PsiAnnotation annotation = ApplicationManager.getApplication().runReadAction(new Computable<PsiAnnotation>() {

        @Override
        public PsiAnnotation compute() {
            try {
                return getAnnotation(debuggerContext);
            } catch (IndexNotReadyException e) {
                return null;
            }
        }
    });
    if (annotation != null) {
        ResourceIdResolver resolver = ServiceManager.getService(myEvaluationContext.getProject(), ResourceIdResolver.class);
        DynamicResourceIdResolver resolver1 = new DynamicResourceIdResolver(myEvaluationContext, resolver);
        myResult = AnnotationsRenderer.render(resolver1, annotation, ((IntegerValue) myValue).value());
    }
    evaluationResult("");
}
Also used : DebugProcess(com.intellij.debugger.engine.DebugProcess) DebugProcessImpl(com.intellij.debugger.engine.DebugProcessImpl) IntegerValue(com.sun.jdi.IntegerValue) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) PsiAnnotation(com.intellij.psi.PsiAnnotation)

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