Commit c0bd89e7 authored by Sarah Grebing's avatar Sarah Grebing

Bigfix in relaoding contracts

parent 291eec9d
Pipeline #23252 passed with stages
in 82 minutes and 7 seconds
......@@ -8,6 +8,7 @@ import de.uka.ilkd.key.java.Services;
import de.uka.ilkd.key.proof.Goal;
import de.uka.ilkd.key.proof.Proof;
import de.uka.ilkd.key.proof.init.ProofInputException;
import de.uka.ilkd.key.proof.init.ProofOblInput;
import de.uka.ilkd.key.proof.io.ProblemLoaderException;
import de.uka.ilkd.key.speclang.Contract;
import edu.kit.iti.formal.psdbg.interpreter.data.GoalNode;
......@@ -91,8 +92,23 @@ public class KeYProofFacade {
*/
public void reload(File problemFile) throws ProofInputException, ProblemLoaderException {
if (contract.get() != null) {// reinstante the contract
setProof(getEnvironment().createProof(
contract.get().getProofObl(getEnvironment().getServices())));
pma = KeYApi.loadFromKeyFile(problemFile);
List<Contract> contracts = pma.getProofContracts();
contracts.forEach(contract1 -> {
if(contract.get().getName().equals(contract1.getName())){
contractProperty().set(contract1);
}
});
if(contract.get() != null){
try{
activateContract(contract.get());
}catch (ProofInputException pie){
throw new ProofInputException("Contract not reloadable.", pie.getCause());
}
}
/*setProof(getEnvironment().createProof(
contract.get().getProofObl(getEnvironment().getServices())));*/
} else {
setProof(KeYApi.loadFromKeyFile(problemFile).getLoadedProof().getProof());
}
......
......@@ -545,10 +545,11 @@ public class DebuggerMain implements Initializable {
//save old information and refresh models
statusBar.publishMessage("Reloading...");
File lastLoaded;
Contract chosen = null;
if (model.getKeyFile() != null) {
lastLoaded = model.getKeyFile();
} else {
Contract chosen = model.getChosenContract();
chosen = model.getChosenContract();
lastLoaded = model.getJavaFile();
}
//model.reload();
......@@ -562,8 +563,11 @@ public class DebuggerMain implements Initializable {
iModel.clearHighlightLines();
iModel.getGoals().clear();
iModel.setSelectedGoalNodeToShow(null);
if(chosen != null) {
FACADE.contractProperty().set(chosen);
}
try {
FACADE.reload(lastLoaded);
if (iModel.getGoals().size() > 0) {
iModel.setSelectedGoalNodeToShow(iModel.getGoals().get(0));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment