Search in sources :

Example 1 with XValueModifier

use of com.intellij.xdebugger.frame.XValueModifier 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 2 with XValueModifier

use of com.intellij.xdebugger.frame.XValueModifier in project intellij-community by JetBrains.

the class DebuggerUIUtil method setTreeNodeValue.

public static void setTreeNodeValue(XValueNodeImpl valueNode, String text, Consumer<String> errorConsumer) {
    XDebuggerTree tree = valueNode.getTree();
    Project project = tree.getProject();
    XValueModifier modifier = valueNode.getValueContainer().getModifier();
    if (modifier == null)
        return;
    XDebuggerTreeState treeState = XDebuggerTreeState.saveState(tree);
    valueNode.setValueModificationStarted();
    modifier.setValue(text, new XValueModifier.XModificationCallback() {

        @Override
        public void valueModified() {
            if (tree.isDetached()) {
                AppUIUtil.invokeOnEdt(() -> tree.rebuildAndRestore(treeState));
            }
            XDebuggerUtilImpl.rebuildAllSessionsViews(project);
        }

        @Override
        public void errorOccurred(@NotNull final String errorMessage) {
            AppUIUtil.invokeOnEdt(() -> {
                tree.rebuildAndRestore(treeState);
                errorConsumer.consume(errorMessage);
            });
            XDebuggerUtilImpl.rebuildAllSessionsViews(project);
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) XDebuggerTreeState(com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState) XValueModifier(com.intellij.xdebugger.frame.XValueModifier) XDebuggerTree(com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)

Aggregations

XValueModifier (com.intellij.xdebugger.frame.XValueModifier)2 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 Modifier (com.intellij.debugger.engine.evaluation.expression.Modifier)1 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)1 Project (com.intellij.openapi.project.Project)1 XDebuggerTree (com.intellij.xdebugger.impl.ui.tree.XDebuggerTree)1 XDebuggerTreeState (com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState)1 NotNull (org.jetbrains.annotations.NotNull)1