Merge lp:~tapaal-contributor/tapaal/undo-shared-place-transition-1848948 into lp:tapaal

Proposed by Peter Haahr Taankvist
Status: Merged
Approved by: Jiri Srba
Approved revision: 1020
Merged at revision: 1021
Proposed branch: lp:~tapaal-contributor/tapaal/undo-shared-place-transition-1848948
Merge into: lp:tapaal
Diff against target: 52 lines (+12/-5)
2 files modified
src/pipe/gui/widgets/PlaceEditorPanel.java (+6/-3)
src/pipe/gui/widgets/TAPNTransitionEditor.java (+6/-2)
To merge this branch: bzr merge lp:~tapaal-contributor/tapaal/undo-shared-place-transition-1848948
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+374651@code.launchpad.net

Commit message

Making a place or transition shared now only requires one press on undo to undo

To post a comment you must log in.
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
=== modified file 'src/pipe/gui/widgets/PlaceEditorPanel.java'
--- src/pipe/gui/widgets/PlaceEditorPanel.java 2019-03-04 13:27:40 +0000
+++ src/pipe/gui/widgets/PlaceEditorPanel.java 2019-10-24 09:58:47 +0000
@@ -71,6 +71,7 @@
71 private TimedPlaceComponent place;71 private TimedPlaceComponent place;
72 private Context context;72 private Context context;
73 private boolean makeNewShared = false;73 private boolean makeNewShared = false;
74 private boolean doNewEdit = true;
74 75
75 private Vector<TimedPlace> sharedPlaces;76 private Vector<TimedPlace> sharedPlaces;
76 private int maxNumberOfPlacesToShowAtOnce = 20;77 private int maxNumberOfPlacesToShowAtOnce = 20;
@@ -663,9 +664,11 @@
663 JOptionPane.showMessageDialog(this,"It is allowed to have at most " + Pipe.MAX_NUMBER_OF_TOKENS_ALLOWED + " tokens in a place.", "Error", JOptionPane.ERROR_MESSAGE);664 JOptionPane.showMessageDialog(this,"It is allowed to have at most " + Pipe.MAX_NUMBER_OF_TOKENS_ALLOWED + " tokens in a place.", "Error", JOptionPane.ERROR_MESSAGE);
664 return false;665 return false;
665 }666 }
666667 //Only make new edit if it has not already been done
667 context.undoManager().newEdit(); // new "transaction""668 if(doNewEdit) {
668669 context.undoManager().newEdit(); // new "transaction""
670 doNewEdit = false;
671 }
669 TimedPlace underlyingPlace = place.underlyingPlace();672 TimedPlace underlyingPlace = place.underlyingPlace();
670673
671 SharedPlace selectedPlace = (SharedPlace)sharedPlacesComboBox.getSelectedItem();674 SharedPlace selectedPlace = (SharedPlace)sharedPlacesComboBox.getSelectedItem();
672675
=== modified file 'src/pipe/gui/widgets/TAPNTransitionEditor.java'
--- src/pipe/gui/widgets/TAPNTransitionEditor.java 2019-03-04 13:27:40 +0000
+++ src/pipe/gui/widgets/TAPNTransitionEditor.java 2019-10-24 09:58:47 +0000
@@ -46,6 +46,7 @@
46 private Context context;46 private Context context;
47 47
48 private int maxNumberOfTransitionsToShowAtOnce = 20;48 private int maxNumberOfTransitionsToShowAtOnce = 20;
49 boolean doNewEdit = true;
4950
50 public TAPNTransitionEditor(JRootPane _rootPane, TimedTransitionComponent _transition, Context context) {51 public TAPNTransitionEditor(JRootPane _rootPane, TimedTransitionComponent _transition, Context context) {
51 rootPane = _rootPane;52 rootPane = _rootPane;
@@ -396,8 +397,11 @@
396 if(urgentCheckBox.isSelected() && !isUrgencyOK()){397 if(urgentCheckBox.isSelected() && !isUrgencyOK()){
397 return false;398 return false;
398 }399 }
399 400 //Only do new edit if it has not already been done
400 context.undoManager().newEdit(); // new "transaction""401 if(doNewEdit) {
402 context.undoManager().newEdit(); // new "transaction""
403 doNewEdit = false;
404 }
401 405
402 boolean wasShared = transition.underlyingTransition().isShared() && !sharedCheckBox.isSelected();406 boolean wasShared = transition.underlyingTransition().isShared() && !sharedCheckBox.isSelected();
403 if(transition.underlyingTransition().isShared()){407 if(transition.underlyingTransition().isShared()){

Subscribers

People subscribed via source and target branches