package jetbrains.mps.debugger.java.runtime.breakpoints;
/*Generated by MPS */
import jetbrains.mps.util.Computable;
import jetbrains.mps.debug.api.breakpoints.BreakpointLocation;
import org.jetbrains.mps.openapi.model.SNodeReference;
import org.jetbrains.mps.openapi.module.SRepository;
import org.jetbrains.annotations.NotNull;
import jetbrains.mps.smodel.ModelAccessHelper;
import org.jetbrains.mps.openapi.model.SNode;
/**
* Given persistence presentation of breakpoint location (SNodeReference now), build actual location, connected with target code, if any
*/
/*package*/ class BreakpointLocationUpdate implements Computable<BreakpointLocation> {
private final SNodeReference myLocation;
private final SRepository myRepo;
public BreakpointLocationUpdate(@NotNull SNodeReference location, @NotNull final SRepository repo) {
myLocation = location;
myRepo = repo;
}
@NotNull
public BreakpointLocation get() {
return new ModelAccessHelper(myRepo).runReadAction(this);
}
public BreakpointLocation compute() {
SNode node = myLocation.resolve(myRepo);
return (node == null ? new BreakpointLocation(myLocation) : new BreakpointLocation(node));
}
}