Commit a2b1fa2f authored by LULUDBR\Lulu's avatar LULUDBR\Lulu

Savepoints ground + adding Info + Warning dialog + expansion of goalmatcher

parent e141acf7
Pipeline #21480 passed with stages
in 4 minutes and 15 seconds
package edu.kit.iti.formal.psdbg.parser;
import edu.kit.iti.formal.psdbg.parser.ast.*;
import javafx.util.Pair;
public class SavepointVisitor extends DefaultASTVisitor {
@Override
public Parameters visit(CallStatement call) {
if (call.getCommand().toString().equals("save")) {
Parameters param = call.getParameters().copy();
return param;
} else {
return null;
}
}
}
package edu.kit.iti.formal.psdbg.interpreter.funchdl;
import edu.kit.iti.formal.psdbg.interpreter.Interpreter;
import edu.kit.iti.formal.psdbg.interpreter.data.VariableAssignment;
import edu.kit.iti.formal.psdbg.parser.ast.CallStatement;
import edu.kit.iti.formal.psdbg.parser.ast.Parameters;
import edu.kit.iti.formal.psdbg.parser.ast.Variable;
import edu.kit.iti.formal.psdbg.parser.data.Value;
import java.io.File;
import java.math.BigInteger;
import java.nio.file.Path;
public class SaveCommand extends BuiltinCommands.BuiltinCommand<String>{
public SaveCommand() {
super("save");
}
@Override
public void evaluate(Interpreter<String> interpreter, CallStatement call, VariableAssignment params, String data) {
//TODO: another param entry with id for the savepoint
Value<Path> val = (Value<Path>) params.getValues().getOrDefault(
new Variable("filepath"),
Value.from(2));
File savepoint = new File(val.toString());
}
private class Parameters extends edu.kit.iti.formal.psdbg.parser.ast.Parameters{
}
}
......@@ -74,6 +74,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.*;
......@@ -133,6 +134,9 @@ public class DebuggerMain implements Initializable {
@FXML
private Button interactive_undo;
@FXML
private ComboBox<Path> combo_savepoints;
private JavaArea javaArea = new JavaArea();
private DockNode javaAreaDock = new DockNode(javaArea, "Java Source",
......@@ -356,6 +360,7 @@ public class DebuggerMain implements Initializable {
statusBar.interpreterStatusModelProperty().bind(model.interpreterStateProperty());
renewThreadStateTimer();
}
/**
......@@ -934,7 +939,7 @@ public class DebuggerMain implements Initializable {
assert model.getDebuggerFramework() != null : "You should have started the prove";
model.getDebuggerFramework().execute(new ContinueCommand<>());
} catch (DebuggerException e) {
Utils.showExceptionDialog("", "", "", e);
Utils.showWarningDialog("", "", "", e);
LOGGER.error(e);
}
}
......@@ -1229,6 +1234,12 @@ public class DebuggerMain implements Initializable {
}
}
@FXML
public void selectSavepoint(ActionEvent actionEvent) {
}
@FXML
public void showWelcomeDock(ActionEvent actionEvent) {
if (!welcomePaneDock.isDocked() && !welcomePaneDock.isFloating()) {
......@@ -1475,6 +1486,8 @@ public class DebuggerMain implements Initializable {
}
}
//endregion
}
//deprecated
......
......@@ -213,7 +213,7 @@ public class InteractiveModeController {
sb.append("\nSequent Formula: formula=").append(sfTerm);
sb.append("\nOn Sub Term: on=").append(onTerm);
Utils.showExceptionDialog("Proof Command was not applicable",
Utils.showWarningDialog("Proof Command was not applicable",
"Proof Command was not applicable.",
sb.toString(), e);
}
......
......@@ -49,7 +49,7 @@ public class SequentOptionsMenu extends ContextMenu {
} catch (Exception e) {
Utils.showExceptionDialog("Please Select a Goal first." ,
Utils.showInfoDialog("Please Select a Goal first." ,
"Please Select a Goal node from the list first to open the SequentMatcher Window.",
"Please Select a Goal node from the list first to open the SequentMatcher Window.", e);
// e.printStackTrace();
......
......@@ -203,6 +203,48 @@ public class Utils {
alert.showAndWait();
}
public static void showWarningDialog(String title, String headerText, String contentText, Throwable ex) {
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.setContentText(contentText);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String exceptionText = sw.toString();
alert.setWidth(400);
alert.setHeight(400);
alert.setHeight(600);
alert.setWidth(400);
alert.showAndWait();
}
public static void showInfoDialog(String title, String headerText, String contentText, Throwable ex) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.setContentText(contentText);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
String exceptionText = sw.toString();
alert.setWidth(400);
alert.setHeight(400);
alert.setHeight(600);
alert.setWidth(400);
alert.showAndWait();
}
public static void addDebugListener(Property<?> property) {
property.addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> {
String simpleName = property.getBean() != null ? property.getBean().getClass().getSimpleName() : "<n/a>";
......
......@@ -323,7 +323,9 @@
<Tooltip text="Undo"/>
</tooltip>
</Button>
<ComboBox fx:id="combo_savepoints" disable="true" prefWidth="100" prefHeight="30">
</ComboBox>
<Pane HBox.hgrow="ALWAYS"/>
<Label text="Windows:"/>
......
......@@ -27,7 +27,7 @@
<Label labelFor="$frames" text="Contexts:"/>
<ComboBox fx:id="frames" HBox.hgrow="ALWAYS"/>
</HBox>
<ListView fx:id="goalView"/>
<ListView fx:id="goalView" styleClass="goal-view"/>
</VBox>
</center>
</SectionPane>
......
......@@ -31,6 +31,13 @@
<ListView fx:id="goalView"/>
</VBox>
</center>
<Label text="Matching Pattern for Goals"
></Label>
<TextArea fx:id="matchpattern_goal" minHeight="0.0" minWidth="0.0" prefHeight="159.0"
prefWidth="639.0"
/>
<Button mnemonicParsing="false" text="Start Matching"
onMouseClicked="#startMatchGoal"/>
</SectionPane>
<SplitPane dividerPositions="0.4189895470383275" prefHeight="500" prefWidth="800">
<SectionPane title="Sequent" minHeight="0.0" minWidth="0.0" prefHeight="633.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