Merge lp:~tapaal-contributor/tapaal/disappearing-tokens-1940098 into lp:tapaal

Proposed by Lena Ernstsen
Status: Merged
Approved by: Jiri Srba
Approved revision: 1136
Merged at revision: 1137
Proposed branch: lp:~tapaal-contributor/tapaal/disappearing-tokens-1940098
Merge into: lp:tapaal
Diff against target: 41 lines (+16/-4)
2 files modified
src/dk/aau/cs/gui/SharedPlaceNamePanel.java (+1/-1)
src/dk/aau/cs/model/tapn/TimedPlace.java (+15/-3)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/disappearing-tokens-1940098
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+407251@code.launchpad.net

Commit message

Stopped tokens from disappearing when shared place names are changed

To post a comment you must log in.
Revision history for this message
Jiri Srba (srba) wrote :

Tested and fixes the problem

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/dk/aau/cs/gui/SharedPlaceNamePanel.java'
--- src/dk/aau/cs/gui/SharedPlaceNamePanel.java 2021-04-08 08:30:29 +0000
+++ src/dk/aau/cs/gui/SharedPlaceNamePanel.java 2021-08-17 11:36:29 +0000
@@ -150,7 +150,7 @@
150 150
151 try{151 try{
152 placeToEdit.setName(name);152 placeToEdit.setName(name);
153 }catch(RequireException e){153 }catch(RequireException e){
154 JOptionPane.showMessageDialog(SharedPlaceNamePanel.this, "The specified name is invalid.\nAcceptable names are defined by the regular expression:\n[a-zA-Z][_a-zA-Z0-9]* \n\nNote that \"true\" and \"false\" are reserved keywords.", "Error", JOptionPane.ERROR_MESSAGE);154 JOptionPane.showMessageDialog(SharedPlaceNamePanel.this, "The specified name is invalid.\nAcceptable names are defined by the regular expression:\n[a-zA-Z][_a-zA-Z0-9]* \n\nNote that \"true\" and \"false\" are reserved keywords.", "Error", JOptionPane.ERROR_MESSAGE);
155 nameField.requestFocusInWindow();155 nameField.requestFocusInWindow();
156 return false;156 return false;
157157
=== modified file 'src/dk/aau/cs/model/tapn/TimedPlace.java'
--- src/dk/aau/cs/model/tapn/TimedPlace.java 2020-08-04 08:53:19 +0000
+++ src/dk/aau/cs/model/tapn/TimedPlace.java 2021-08-17 11:36:29 +0000
@@ -37,9 +37,21 @@
37 public void setName(String newName) {37 public void setName(String newName) {
38 Require.that(newName != null && !newName.isEmpty(), "A timed place must have a name");38 Require.that(newName != null && !newName.isEmpty(), "A timed place must have a name");
39 Require.that(isValid(newName) && !newName.toLowerCase().equals("true") && !newName.toLowerCase().equals("false"), "The specified name must conform to the pattern [a-zA-Z_][a-zA-Z0-9_]*");39 Require.that(isValid(newName) && !newName.toLowerCase().equals("true") && !newName.toLowerCase().equals("false"), "The specified name must conform to the pattern [a-zA-Z_][a-zA-Z0-9_]*");
40 this.name = newName;40 List<TimedToken> tokens = null;
41 fireNameChanged();41
42 }42 if (currentMarking != null) {
43 if (currentMarking.getTokensFor(this).size() != 0) {
44 tokens = tokens();
45 currentMarking.removePlaceFromMarking(this);
46 }
47 this.name = newName;
48 if (tokens != null) addTokens(tokens);
49 fireNameChanged();
50 } else {
51 this.name = newName;
52 fireNameChanged();
53 }
54 }
4355
44 public TimeInvariant invariant(){56 public TimeInvariant invariant(){
45 return invariant;57 return invariant;

Subscribers

People subscribed via source and target branches