package jetbrains.mps.debugger.java.runtime.state.watchables;

/*Generated by MPS */

import jetbrains.mps.annotations.GeneratedClass;
import jetbrains.mps.debugger.java.api.state.watchables.JavaWatchable;
import jetbrains.mps.debugger.java.runtime.state.values.FieldWatchpointValue;
import com.sun.jdi.Field;
import com.sun.jdi.Value;
import com.sun.jdi.ThreadReference;
import jetbrains.mps.debugger.java.api.state.proxy.JavaValue;
import jetbrains.mps.debugger.java.api.state.customViewers.CustomViewersManager;
import jetbrains.mps.debug.api.programState.WatchablesCategory;
import jetbrains.mps.debugger.java.api.state.watchables.JavaWatchablesCategory;
import jetbrains.mps.debug.api.programState.IValue;
import javax.swing.Icon;
import jetbrains.mps.debugger.java.api.ui.Icons;

@GeneratedClass(node = "r:50efd6f2-8d02-4682-b313-bd69c46e78df(jetbrains.mps.debugger.java.runtime.state.watchables)/3187167456722649969", model = "r:50efd6f2-8d02-4682-b313-bd69c46e78df(jetbrains.mps.debugger.java.runtime.state.watchables)")
/*package*/ class JavaWatchpointWatchable extends JavaWatchable {
  private final FieldWatchpointValue myValue;
  public JavaWatchpointWatchable(Field field, Value currentValue, Value newValue, ThreadReference threadReference) {
    super(threadReference);
    JavaValue current = CustomViewersManager.getInstance().fromJdi(currentValue, threadReference);
    JavaValue neww = CustomViewersManager.getInstance().fromJdi(newValue, threadReference);
    myValue = new FieldWatchpointValue(field, false, current, neww, threadReference);
  }
  public JavaWatchpointWatchable(Field field, Value currentValue, ThreadReference threadReference) {
    super(threadReference);
    JavaValue current = CustomViewersManager.getInstance().fromJdi(currentValue, threadReference);
    myValue = new FieldWatchpointValue(field, true, current, null, threadReference);
  }
  @Override
  public String getName() {
    return "field watchpoint";
  }
  @Override
  public WatchablesCategory getCategory() {
    return JavaWatchablesCategory.FIELD_WATCHPOINT;
  }
  @Override
  public IValue getValue() {
    return myValue;
  }
  @Override
  public Icon getPresentationIcon() {
    return Icons.VALUE_OBJECT;
  }
}
