From b4a17252b5658e8ad5fa0171148553ec6aa61cb3 Mon Sep 17 00:00:00 2001 From: Lulu Luong Date: Wed, 26 Sep 2018 15:22:39 +0200 Subject: [PATCH] variable assigment button moved to SequentOptionsMenu Bug: model.getSelectedGoalNodeToShow().getAssignment() in GoalOptionsMenu is always empty --- .../psdbg/gui/controls/GoalOptionsMenu.java | 24 +++++++++++++++++ .../psdbg/gui/controls/InspectionView.java | 2 ++ .../psdbg/gui/controls/SequentMatcher.java | 4 +++ .../gui/controls/SequentOptionsMenu.java | 26 +++---------------- .../gui/controls/SequentOptionsMenu.fxml | 1 - 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/GoalOptionsMenu.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/GoalOptionsMenu.java index 92305fbb..dddcd44e 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/GoalOptionsMenu.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/GoalOptionsMenu.java @@ -24,6 +24,11 @@ public class GoalOptionsMenu extends ContextMenu { @FXML private RadioMenuItem rmiShowSequent, rmiCFL, rmiCFS, rmiBranchLabels, rmiNodeNames, rmiRuleNames; + @FXML + private MenuItem showVarAssignment; + + @Setter + private InspectionModel model; private ObjectProperty selectedViewOption = new SimpleObjectProperty<>(); @@ -51,7 +56,26 @@ public class GoalOptionsMenu extends ContextMenu { selectedViewOption.setValue(ViewOption.SEQUENT); + showVarAssignment.setOnAction(new EventHandler() { + @Override + public void handle(ActionEvent event) { + + if(model == null || model.getSelectedGoalNodeToShow() == null) { + Utils.showInfoDialog("Select a goal", "Select a goal", "Please select a goal first."); + return; + } + VariableAssignment var_assignm = model.getSelectedGoalNodeToShow().getAssignments(); + Stage stage = new Stage(); + stage.setTitle("Variable Assignment"); + VariableAssignmentWindow vaw = new VariableAssignmentWindow(var_assignm); + + Scene scene = new Scene(vaw); + stage.setScene(scene); + + stage.show(); + } + }); } diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/InspectionView.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/InspectionView.java index 83e30bfc..9d479357 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/InspectionView.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/InspectionView.java @@ -138,6 +138,8 @@ public class InspectionView extends BorderPane { Utils.addDebugListener(model.get().currentInterpreterGoalProperty()); Utils.addDebugListener(model.get().highlightedJavaLinesProperty()); + goalOptionsMenu.setModel(model.get()); + /*TODO redefine CSS bases on selected mode mode.addListener(o -> { getStyleClass().removeAll( diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentMatcher.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentMatcher.java index ea16cfc9..bb694416 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentMatcher.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentMatcher.java @@ -25,6 +25,7 @@ import javafx.scene.control.ListView; import javafx.scene.control.TextArea; import javafx.scene.input.MouseEvent; import javafx.scene.layout.BorderPane; +import lombok.Getter; import org.controlsfx.control.StatusBar; import java.util.HashMap; @@ -40,6 +41,8 @@ public class SequentMatcher extends BorderPane { private final ListProperty> results = new SimpleListProperty<>(this, "results", FXCollections.observableArrayList()); //sicht user selected private final ObjectProperty> selectedGoalNodeToShow = new SimpleObjectProperty<>(this, "selectedGoalNodeToShow"); + + @Getter public GoalOptionsMenu goalOptionsMenu = new GoalOptionsMenu(); @FXML private SequentViewForMatcher sequentView; @@ -97,6 +100,7 @@ public class SequentMatcher extends BorderPane { } }); + } private void calculateLookupTable() { diff --git a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.java b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.java index 899561df..5c5768c7 100644 --- a/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.java +++ b/ui/src/main/java/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.java @@ -17,8 +17,7 @@ public class SequentOptionsMenu extends ContextMenu { private final InspectionModel model; @FXML private MenuItem openSequentMatcher; - @FXML - private MenuItem showVarAssignment; + @@ -35,6 +34,9 @@ public class SequentOptionsMenu extends ContextMenu { KeyData data = (KeyData) model.getSelectedGoalNodeToShow().getData(); SequentMatcher root1 = new SequentMatcher(data.getProof().getServices()); + + root1.getGoalOptionsMenu().setModel(model); + root1.setGoals(model.getGoals()); root1.setSelectedGoalNodeToShow(model.getSelectedGoalNodeToShow()); root1.getStyleClass().add("sequent-view"); @@ -63,26 +65,6 @@ public class SequentOptionsMenu extends ContextMenu { }); - showVarAssignment.setOnAction(new EventHandler() { - @Override - public void handle(ActionEvent event) { - - if(model == null || model.getSelectedGoalNodeToShow() == null) { - Utils.showInfoDialog("Select a goal", "Select a goal", "Please select a goal first."); - return; - } - VariableAssignment var_assignm = model.getSelectedGoalNodeToShow().getAssignments(); - - Stage stage = new Stage(); - stage.setTitle("Variable Assignment"); - VariableAssignmentWindow vaw = new VariableAssignmentWindow(var_assignm); - - Scene scene = new Scene(vaw); - stage.setScene(scene); - - stage.show(); - } - }); } diff --git a/ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.fxml b/ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.fxml index 84c75428..130c5ad2 100644 --- a/ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.fxml +++ b/ui/src/main/resources/edu/kit/iti/formal/psdbg/gui/controls/SequentOptionsMenu.fxml @@ -6,6 +6,5 @@ prefHeight="400.0" prefWidth="600.0" type="javafx.scene.control.ContextMenu"> - \ No newline at end of file -- GitLab