From 19986b130987f4ca2977444ed9106ef1f612acb5 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 10 May 2018 15:17:20 +0100 Subject: [PATCH] JAL-591 reduced updating by checking/setting 'updating' flag --- src/jalview/gui/OptsAndParamsPage.java | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) 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; } } -- 1.7.10.2