JAL-2716 fix to reset choice parameter on Revert
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 22 May 2018 16:06:10 +0000 (17:06 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 22 May 2018 16:06:10 +0000 (17:06 +0100)
src/jalview/gui/OptsAndParamsPage.java

index c09d729..4cac990 100644 (file)
@@ -559,7 +559,7 @@ public class OptsAndParamsPage
     {
       if (adjusting)
       {
-        // return;
+        return;
       }
       if (!isChoiceParameter)
       {
@@ -724,7 +724,6 @@ public class OptsAndParamsPage
         if (isChoiceParameter)
         {
           choicebox = buildComboBox(parm);
-          choicebox.setSelectedItem(parm.getValue());
           choicebox.addActionListener(this);
           controlsPanel.add(choicebox, BorderLayout.CENTER);
         }
@@ -757,9 +756,17 @@ public class OptsAndParamsPage
         }
       }
 
-      if (!isChoiceParameter && parm != null)
+      String value = parm.getValue();
+      if (value != null)
       {
-        valueField.setText(parm.getValue());
+        if (isChoiceParameter)
+        {
+          choicebox.setSelectedItem(value);
+        }
+        else
+        {
+          valueField.setText(value);
+        }
       }
       lastVal = updateSliderFromValueField();
       adjusting = false;