From: gmungoc Date: Thu, 10 May 2018 14:17:20 +0000 (+0100) Subject: JAL-591 reduced updating by checking/setting 'updating' flag X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=19986b130987f4ca2977444ed9106ef1f612acb5;p=jalview.git JAL-591 reduced updating by checking/setting 'updating' flag --- diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 5ef7169..dcd07ef 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -552,13 +552,23 @@ public class OptsAndParamsPage */ private void checkIfModified() { - Object newValue = updateSliderFromValueField(); - boolean modified = true; - if (newValue.getClass() == lastVal.getClass()) + if (!adjusting) { - modified = !newValue.equals(lastVal); + try + { + adjusting = true; + Object newValue = updateSliderFromValueField(); + boolean modified = true; + if (newValue.getClass() == lastVal.getClass()) + { + modified = !newValue.equals(lastVal); + } + pmdialogbox.argSetModified(this, modified); + } finally + { + adjusting = false; + } } - pmdialogbox.argSetModified(this, modified); } @Override @@ -632,8 +642,13 @@ public class OptsAndParamsPage @Override public void stateChanged(ChangeEvent e) { - if (!adjusting) + if (adjusting) { + return; + } + try + { + adjusting = true; if (!isLogarithmicParameter) { /* @@ -651,6 +666,9 @@ public class OptsAndParamsPage valueField.setText(formatDouble(value)); } checkIfModified(); + } finally + { + adjusting = false; } }