diff options
author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 13:55:26 +0200 |
---|---|---|
committer | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2022-07-07 13:55:26 +0200 |
commit | 25bbd0eeca461fb5d501854c14ecec797603d8cc (patch) | |
tree | eca22c71f0faef0e5439948953b58d320cfd7cde /pdf-over-gui/src/main/java | |
parent | 8610371549aacedf5dc7bf7435a401b410e1ffef (diff) | |
download | pdf-over-25bbd0eeca461fb5d501854c14ecec797603d8cc.tar.gz pdf-over-25bbd0eeca461fb5d501854c14ecec797603d8cc.tar.bz2 pdf-over-25bbd0eeca461fb5d501854c14ecec797603d8cc.zip |
clean up the clean-up logic
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r-- | pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java index 3b03de78..3920b4d7 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/Status.java @@ -57,21 +57,18 @@ public class Status { return this.currentState; } - public void setCurrentState(State currentState) { - log.debug("Changing from " + this.currentState + " to " + currentState); + public void setCurrentState(State newState) { + log.debug("Changing from " + currentState + " to " + newState); - if (this.previousState != this.currentState) + if ((previousState != null) && (previousState != currentState) && (previousState != newState)) { // Reference to previous state will be lost - perform cleanup - if (this.previousState != null) - { - log.debug("Cleaning up " + this.previousState); - this.previousState.cleanUp(); - } + log.debug("Cleaning up " + previousState); + previousState.cleanUp(); } - this.previousState = this.currentState; - this.currentState = currentState; + this.previousState = currentState; + this.currentState = newState; } public State getPreviousState() { |