Search in sources :

Example 1 with Modifier

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

the class EditSourceAction method getSourcePosition.

private static SourcePosition getSourcePosition(DebuggerTreeNodeImpl selectedNode, DebuggerContextImpl debuggerContext) {
    final DebuggerContextImpl context = debuggerContext;
    if (selectedNode == null || context == null) {
        return null;
    }
    final Project project = selectedNode.getProject();
    final DebuggerSession debuggerSession = context.getDebuggerSession();
    if (debuggerSession == null) {
        return null;
    }
    NodeDescriptorImpl nodeDescriptor = selectedNode.getDescriptor();
    if (nodeDescriptor instanceof WatchItemDescriptor) {
        Modifier modifier = ((WatchItemDescriptor) nodeDescriptor).getModifier();
        if (modifier == null) {
            return null;
        }
        nodeDescriptor = (NodeDescriptorImpl) modifier.getInspectItem(project);
    }
    final NodeDescriptorImpl nodeDescriptor1 = nodeDescriptor;
    return ApplicationManager.getApplication().runReadAction(new Computable<SourcePosition>() {

        public SourcePosition compute() {
            return SourcePositionProvider.getSourcePosition(nodeDescriptor1, project, context);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) DebuggerSession(com.intellij.debugger.impl.DebuggerSession) SourcePosition(com.intellij.debugger.SourcePosition) DebuggerContextImpl(com.intellij.debugger.impl.DebuggerContextImpl) WatchItemDescriptor(com.intellij.debugger.ui.impl.watch.WatchItemDescriptor) Modifier(com.intellij.debugger.engine.evaluation.expression.Modifier) NodeDescriptorImpl(com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)

Example 2 with Modifier

use of com.intellij.debugger.engine.evaluation.expression.Modifier 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)

Aggregations

Modifier (com.intellij.debugger.engine.evaluation.expression.Modifier)2 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)2 SourcePosition (com.intellij.debugger.SourcePosition)1 JavaValue (com.intellij.debugger.engine.JavaValue)1 JavaValueModifier (com.intellij.debugger.engine.JavaValueModifier)1 EvaluateException (com.intellij.debugger.engine.evaluation.EvaluateException)1 EvaluationContextImpl (com.intellij.debugger.engine.evaluation.EvaluationContextImpl)1 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)1 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)1 WatchItemDescriptor (com.intellij.debugger.ui.impl.watch.WatchItemDescriptor)1 Project (com.intellij.openapi.project.Project)1 XValueModifier (com.intellij.xdebugger.frame.XValueModifier)1 NotNull (org.jetbrains.annotations.NotNull)1