Merge lp:~tapaal-contributor/tapaal/manual-edit-error-messages into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1138
Merged at revision: 1143
Proposed branch: lp:~tapaal-contributor/tapaal/manual-edit-error-messages
Merge into: lp:tapaal
Diff against target: 51 lines (+16/-4)
1 file modified
src/pipe/gui/widgets/QueryDialog.java (+16/-4)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/manual-edit-error-messages
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+407311@code.launchpad.net

Commit message

The error found during parsing manually edited queries is shown to the user

To post a comment you must log in.
1138. By <email address hidden>

fixed spacing between "placeswere used"

Revision history for this message
Jiri Srba (srba) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/pipe/gui/widgets/QueryDialog.java'
2--- src/pipe/gui/widgets/QueryDialog.java 2021-08-12 08:28:49 +0000
3+++ src/pipe/gui/widgets/QueryDialog.java 2021-09-11 17:12:22 +0000
4@@ -2293,15 +2293,28 @@
5 TCTLAbstractProperty newQuery = null;
6
7 try {
8- if (lens.isTimed()) {
9+ if (queryField.getText().trim().equals("<*>")) {
10+ int choice = JOptionPane.showConfirmDialog(
11+ CreateGui.getApp(),
12+ "It is not possible to parse an empty query.\nThe specified query has not been saved. Do you want to edit it again?",
13+ "Error Parsing Query",
14+ JOptionPane.YES_NO_OPTION,
15+ JOptionPane.ERROR_MESSAGE);
16+ if (choice == JOptionPane.NO_OPTION)
17+ returnFromManualEdit(null);
18+ else
19+ return;
20+ } else if (lens.isTimed()) {
21 newQuery = TAPAALQueryParser.parse(queryField.getText());
22 } else {
23 newQuery = TAPAALCTLQueryParser.parse(queryField.getText());
24 }
25 } catch (Throwable ex) {
26+ String message = ex.getMessage() == null ? "TAPAAL encountered an error while trying to parse the specified query\n" :
27+ "TAPAAL encountered the following error while trying to parse the specified query:\n\n"+ex.getMessage();
28 int choice = JOptionPane.showConfirmDialog(
29 CreateGui.getApp(),
30- "TAPAAL encountered an error trying to parse the specified query.\n\nWe recommend using the query construction buttons unless you are an experienced user.\n\n The specified query has not been saved. Do you want to edit it again?",
31+ message+"\nWe recommend using the query construction buttons unless you are an experienced user.\n\n The specified query has not been saved. Do you want to edit it again?",
32 "Error Parsing Query",
33 JOptionPane.YES_NO_OPTION,
34 JOptionPane.ERROR_MESSAGE);
35@@ -2309,7 +2322,6 @@
36 returnFromManualEdit(null);
37 else
38 return;
39-
40 }
41
42 if (newQuery != null) // new query parsed successfully
43@@ -2343,7 +2355,7 @@
44 if (isResultFalse) {
45 StringBuilder s = new StringBuilder();
46 s.append("The following places" + (lens.isTimed() ? "" : " or transitions") +
47- "were used in the query, but are not present in your model:\n\n");
48+ " were used in the query, but are not present in your model:\n\n");
49
50 for (String placeName : c.getIncorrectPlaceNames()) {
51 s.append(placeName);

Subscribers

People subscribed via source and target branches