Commit fe78f6e4 authored by Sarah Grebing's avatar Sarah Grebing

Highlighting of node in proof tree, interactive mode now working a bit better

parent e9617e80
Pipeline #15277 failed with stages
in 103 minutes and 11 seconds
......@@ -128,7 +128,7 @@ public class DebuggerMain implements Initializable {
private CheckMenuItem miProofTree;
@FXML
private Button btnIM;
private ToggleButton btnInteractiveMode;
private JavaArea javaArea = new JavaArea();
......@@ -199,6 +199,7 @@ public class DebuggerMain implements Initializable {
model.setDebugMode(false);
scriptController = new ScriptController(dockStation);
interactiveModeController = new InteractiveModeController(scriptController);
btnInteractiveMode.setSelected(false);
inspectionViewsController = new InspectionViewsController(dockStation);
activeInspectorDock = inspectionViewsController.getActiveInterpreterTabDock();
//register the welcome dock in the center
......@@ -499,7 +500,7 @@ public class DebuggerMain implements Initializable {
Platform.runLater(() -> {
scriptController.getDebugPositionHighlighter().remove();
statusBar.publishSuccessMessage("Interpreter finished.");
btnIM.setDisable(false);
btnInteractiveMode.setDisable(false);
assert model.getDebuggerFramework() != null;
PTreeNode<KeyData> statePointer = model.getDebuggerFramework().getStatePointer();
State<KeyData> lastState = statePointer.getStateAfterStmt();
......@@ -858,9 +859,13 @@ public class DebuggerMain implements Initializable {
@FXML
public void interactiveMode(ActionEvent actionEvent) {
interactiveModeController.setActivated(true);
if (btnInteractiveMode.isSelected()) {
interactiveModeController.start(getFacade().getProof(), getInspectionViewsController().getActiveInspectionViewTab().getModel());
} else {
interactiveModeController.stop();
}
}
@FXML
......
......@@ -67,6 +67,7 @@ public class InteractiveModeController {
public void stop() {
Events.unregister(this);
String c = getCasesAsString();
scriptController.getDockNode(scriptArea).close();
Events.fire(new Events.InsertAtTheEndOfMainScript(c));
}
......
......@@ -309,17 +309,19 @@ public class ProofTree extends BorderPane {
}
if (n.childrenCount() == 0) {
ti.getChildren().add(new TreeItem<>(new TreeNode(
n.isClosed() ? "CLOSED GOAL" : "OPEN GOAL", null)));
TreeItem<TreeNode> e = new TreeItem<>(new TreeNode(
n.isClosed() ? "CLOSED GOAL" : "OPEN GOAL", null));
ti.getChildren().add(e);
return ti;
}
Node node = n.child(0);
if (n.childrenCount() == 1) {
ti.getChildren().add(new TreeItem<>(new TreeNode(toString(node), node)));
ti.getChildren().add(new TreeItem<>(new TreeNode(node.serialNr() + ": " + toString(node), node)));
while (node.childrenCount() == 1) {
node = node.child(0);
ti.getChildren().add(new TreeItem<>(new TreeNode(toString(node), node)));
ti.getChildren().add(new TreeItem<>(new TreeNode(node.serialNr() + ": " + toString(node), node)));
}
}
......@@ -364,20 +366,24 @@ public class ProofTree extends BorderPane {
}
};
tftc.setConverter(stringConverter);
//tftc.itemProperty().addListener((p, o, n) -> repaint(tftc));
tftc.itemProperty().addListener((p, o, n) -> {
if (n != null)
repaint(tftc);
});
//colorOfNodes.addListener((InvalidationListener) o -> repaint(tftc));
return tftc;
}
/*private void repaint(TextFieldTreeCell<TreeNode> tftc) {
private void repaint(TextFieldTreeCell<TreeNode> tftc) {
Node n = tftc.getItem().node;
tftc.setStyle("");
if (n != null) {
if (n != null && n.leaf()) {
if (n.isClosed()) {
colorOfNodes.putIfAbsent(n, "green");
colorOfNodes.putIfAbsent(n, "seagreen");
//tftc.setStyle("-fx-background-color: greenyellow");
} else {
colorOfNodes.putIfAbsent(n, "darkred");
}
if (colorOfNodes.containsKey(n)) {
tftc.setStyle("-fx-background-color: " + colorOfNodes.get(n) + ";");
......@@ -385,7 +391,7 @@ public class ProofTree extends BorderPane {
}
expandRootToItem(tftc.getTreeItem());
}*/
}
public Object getColorOfNodes() {
return colorOfNodes.get();
......
......@@ -15,8 +15,6 @@ import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -122,11 +120,42 @@ public class ScriptController {
return getDockNode(findEditor(filepath));
}
private DockNode getDockNode(ScriptArea editor) {
if (editor == null) {
return null;
/**
* Create new DockNode for ScriptArea Tab
*
* @param area ScriptAreaTab
* @return
*/
private DockNode createDockNode(ScriptArea area) {
DockNode dockNode = new DockNode(area, area.getFilePath().getName(), new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT));
dockNode.closedProperty().addListener(o -> {
openScripts.remove(area);
});
area.filePathProperty().addListener((observable, oldValue, newValue) -> dockNode.setTitle(newValue.getName()));
if (lastScriptArea == null)
dockNode.dock(parent, DockPos.LEFT);
else
dockNode.dock(parent, DockPos.CENTER, getDockNode(lastScriptArea));
area.dirtyProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (newValue)
dockNode.setGraphic(new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT));
else
dockNode.setGraphic(new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT_BOX));
}
return openScripts.get(editor);
});
this.lastScriptArea = area;
area.focusedProperty().addListener((observable, oldValue, newValue) -> {
logger.debug("area = [" + area + "]");
if (newValue)
lastScriptArea = area;
});
return dockNode;
}
/**
......@@ -162,42 +191,11 @@ public class ScriptController {
}
}
/**
* Create new DockNode for ScriptArea Tab
*
* @param area ScriptAreaTab
* @return
*/
private DockNode createDockNode(ScriptArea area) {
DockNode dockNode = new DockNode(area, area.getFilePath().getName(), new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT));
dockNode.closedProperty().addListener(o -> {
openScripts.remove(area);
});
area.filePathProperty().addListener((observable, oldValue, newValue) -> dockNode.setTitle(newValue.getName()));
if (lastScriptArea == null)
dockNode.dock(parent, DockPos.LEFT);
else
dockNode.dock(parent, DockPos.LEFT, getDockNode(lastScriptArea));
area.dirtyProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
if (newValue)
dockNode.setGraphic(new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT));
else
dockNode.setGraphic(new MaterialDesignIconView(MaterialDesignIcon.FILE_DOCUMENT_BOX));
public DockNode getDockNode(ScriptArea editor) {
if (editor == null) {
return null;
}
});
this.lastScriptArea = area;
area.focusedProperty().addListener((observable, oldValue, newValue) -> {
logger.debug("area = [" + area + "]");
if (newValue)
lastScriptArea = area;
});
return dockNode;
return openScripts.get(editor);
}
/**
......
......@@ -6,17 +6,26 @@ script test(){
exLeft;
andLeft;
eqSymm formula = `agatha = butler`;
nnf_imp2or formula=`\foral S w6;(hates(agatha,w6) -> hates(butler,w6))`;
nnf_imp2or formula=`\forall S w6;(hates(agatha,w6) -> hates(butler,w6))`;
}
script SolveAgathaRiddle_1() {
impRight;
andLeft;
notLeft;
repeat { andLeft; }
exLeft;
andLeft;
eqSymm formula = `agatha = butler`;
auto;
}
script SolveAgathaRiddle_2() {
impRight;
andLeft;
notLeft;
andLeft;
andLeft;
andLeft;
......@@ -27,27 +36,12 @@ script SolveAgathaRiddle_1() {
andLeft;
andLeft;
andLeft;
exLeft;
andLeft;
eqSymm formula = `agatha = butler`;
auto;
//nnf_imp2or on= `hates(agatha, w6) -> hates(butler, w6)`;
//nnf_imp2or; -> wirft hier ScriptCommandNotApplicableException
//wirft ansonsten immer java.lang.RuntimeException: de.uka.ilkd.key.macros.scripts.meta.ConversionException: Could not convert value hates(agatha, w6) -> hates(butler, w6) to type interface de.uka.ilkd.key.logic.Term
// at
//nnf_imp2or formula= `hates(agatha, w6) -> hates(butler, w6)`;
//nnf_imp2or on = `hates(agatha, w6) -> hates(butler, w6)` formula=` \forall S w6; (hates(agatha, w6) -> hates(butler, w6))`;
}
script SolveAgathaRiddle_2() {
impRight;
andLeft;
notLeft;
repeat { andLeft; }
exLeft;
andLeft;
eqSymm formula = `agatha = butler`;
nnf_imp2or formula=`\forall S w6;(hates(agatha,w6) -> hates(butler,w6))`;
auto;
}
......@@ -10,7 +10,6 @@ class Bubblesort {
public int[] bubbleSort(int[] arr) {
int temp = 0;
/*@
@ loop_invariant 0 <= i && i <= arr.length;
@ loop_invariant (\forall int a,b; a >= arr.length - i && b <= arr.length && a < b && i > 0; arr[a] <= arr[b]);
......@@ -18,7 +17,6 @@ class Bubblesort {
@ decreases arr.length - i;
@*/
for(int i=0; i < arr.length; i++){
/*@
@ loop_invariant 1 <= j && j <= arr.length - i + 1;
@ assignable arr[*], temp;
......@@ -41,7 +39,7 @@ class Bubblesort {
/*@ public normal_behaviour
@ requires arr != null;
@ requires arr.length > 0;
@ ensures true;
@ ensures \result == true;
@*/
public boolean test(int[] arr) {
arr = bubbleSort(arr);
......
......@@ -3,36 +3,8 @@ script t1(){
cases{
case match `?X >= 0,?X > 0 ==>`:
cut `?X = 0`[?X \ X];
foreach{
auto;
}
//foreach{
// auto;
//}
}
script t2(){
symbex;
cases{
case match '.*x.*':
auto;
default:
auto;
}
}
script t(){
symbex;
foreach{
simp_heap;
}
}
......@@ -275,7 +275,7 @@
</tooltip>
</Button>
<Button fx:id="btnIM" onAction="#interactiveMode" disable="true">
<ToggleButton fx:id="btnInteractiveMode" onAction="#interactiveMode" disable="true">
<!--disable="${! controller.debugMode}"-->
<graphic>
<MaterialDesignIconView glyphName="HAND_POINTING_RIGHT" size="24.0"/>
......@@ -283,7 +283,7 @@
<tooltip>
<Tooltip text="Start/Stop Interactive Mode"/>
</tooltip>
</Button>
</ToggleButton>
<Pane HBox.hgrow="ALWAYS"/>
<Label text="Windows:"/>
......
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