Package com.dci.intellij.dbn.debugger.frame

Source Code of com.dci.intellij.dbn.debugger.frame.DBProgramDebugValueModifier

package com.dci.intellij.dbn.debugger.frame;

import com.dci.intellij.dbn.database.common.debug.BasicOperationInfo;
import com.dci.intellij.dbn.debugger.DBProgramDebugProcess;
import com.intellij.xdebugger.frame.XValueModifier;
import org.jetbrains.annotations.NotNull;

import java.sql.SQLException;

public class DBProgramDebugValueModifier extends XValueModifier {
    private DBProgramDebugValue value;

    public DBProgramDebugValueModifier(DBProgramDebugValue value) {
        this.value = value;
    }

    @Override
    public void setValue(@NotNull String expression, @NotNull XModificationCallback callback) {
        DBProgramDebugProcess debugProcess = value.getDebugProcess();
        try {
            BasicOperationInfo operationInfo = debugProcess.getDebuggerInterface().setVariableValue(
                    value.getVariableName(),
                    0,
                    expression,
                    debugProcess.getDebugConnection());

            if (operationInfo.getError() != null) {
                callback.errorOccurred("Could not change value. " + operationInfo.getError());
            } else {
                callback.valueModified();
            }
        } catch (SQLException e) {
            callback.errorOccurred(e.getMessage());
        }
    }
}
TOP

Related Classes of com.dci.intellij.dbn.debugger.frame.DBProgramDebugValueModifier

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.