Commit a19583e8 authored by Lulu Luong's avatar Lulu Luong

whole underline

+ Proof tree
parent 2adcc946
Pipeline #22437 passed with stages
in 3 minutes and 21 seconds
......@@ -74,6 +74,7 @@ import org.reactfx.util.Timer;
import javax.annotation.Nullable;
import javax.swing.*;
import javax.xml.bind.JAXBException;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
......@@ -1266,10 +1267,16 @@ public class DebuggerMain implements Initializable {
//Update Gui
MainScriptIdentifier msi = scriptController.getMainScript();
msi.getScriptArea().setSavepointMarker(selected.getLineNumber());
msi.getScriptArea().getCodeArea().setStyleClass(selected.getStartOffset(), selected.getEndOffset() + 1, "underlinesave"); scriptExecutionController.executeScriptFromSavePoint(interpreterBuilder, selected);
scriptController.getMainScript().getScriptArea().underlineSavepoint(selected);
try {
KeyPersistentFacade.read(FACADE.getEnvironment(), FACADE.getProof(), new StringReader(selected.getPersistedStateFile(FACADE.getFilepath()).toString()));
} catch (JAXBException e) {
e.printStackTrace();
}
scriptExecutionController.executeScriptFromSavePoint(interpreterBuilder, selected);
//TODO: KeyPersistentFacade.read(FACADE.getEnvironment(), FACADE.getProof(), new StringReader(selected.getPersistedStateFile(FACADE.getFilepath()).toString()));
//TODO (NullpointerEx: interpreterbuilder == null): scriptExecutionController.executeScriptFromSavePoint(interpreterBuilder, selected);
}
......
......@@ -29,11 +29,9 @@ import javafx.scene.control.cell.TextFieldTreeCell;
import javafx.scene.layout.BorderPane;
import javafx.util.StringConverter;
import lombok.*;
import sun.reflect.generics.tree.Tree;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.function.Consumer;
......@@ -327,12 +325,14 @@ public class ProofTree extends BorderPane {
}
@AllArgsConstructor
private static class TreeNode {
String label;
Node node;
}
class TreeTransformationKey {
public TreeItem<TreeNode> create(Proof proof) {
......@@ -414,6 +414,7 @@ public class ProofTree extends BorderPane {
}
@RequiredArgsConstructor
class TreeTransformationScript extends TreeTransformationKey {
final ProofTreeManager<KeyData> manager;
......@@ -472,5 +473,44 @@ public class ProofTree extends BorderPane {
TreeItem<TreeNode> ti = new TreeItem<>(new TreeNode(lbl, n));
return ti;
}
//TODO: Reverse ArrayList in the end or nah?
@Deprecated
public ArrayList<String> getBranchLabels (TreeNode node) {
TreeItem<TreeNode> proofTree = create(proof.get());
ArrayList<String> branchlabels = new ArrayList<>();
int i = 0;
branchlabels.set(0, node.label);
while (node != null) {
if(!branchlabels.get(i).equals(node.label)) {
i++;
branchlabels.set(i, node.label);
}
//TODO: node = node.parent
}
return branchlabels;
}
public ArrayList<String> getBranchLabels (Node node) {
ArrayList<String> branchlabels = new ArrayList<>();
int i = 0;
//TODO: branchlabel = all branchlabels or only next one
branchlabels.set(0, node.getNodeInfo().getBranchLabel());
Node n = node.parent();
while (n != null) {
if(!branchlabels.get(i).equals(n.getNodeInfo().getBranchLabel())) {
i++;
branchlabels.set(i, n.getNodeInfo().getBranchLabel());
}
n = n.parent();
}
return branchlabels;
}
}
}
......@@ -9,7 +9,10 @@ import edu.kit.iti.formal.psdbg.gui.actions.acomplete.Suggestion;
import edu.kit.iti.formal.psdbg.gui.actions.inline.InlineActionSupplier;
import edu.kit.iti.formal.psdbg.gui.controller.Events;
import edu.kit.iti.formal.psdbg.gui.model.MainScriptIdentifier;
import edu.kit.iti.formal.psdbg.interpreter.data.KeyData;
import edu.kit.iti.formal.psdbg.interpreter.data.SavePoint;
import edu.kit.iti.formal.psdbg.interpreter.dbg.Breakpoint;
import edu.kit.iti.formal.psdbg.interpreter.dbg.PTreeNode;
import edu.kit.iti.formal.psdbg.lint.LintProblem;
import edu.kit.iti.formal.psdbg.lint.LinterStrategy;
import edu.kit.iti.formal.psdbg.parser.Facade;
......@@ -388,8 +391,8 @@ public class ScriptArea extends BorderPane {
}
}
public void underlineSavepoint(){
public void underlineSavepoint(SavePoint sp){
codeArea.setStyle(sp.getLineNumber() -1, Collections.singleton("underlinesave"));
}
private void highlightNonExecutionArea() {
......
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