JAL-2510 ensure modified feature type is displayed
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 4 May 2017 15:13:06 +0000 (16:13 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 4 May 2017 15:13:06 +0000 (16:13 +0100)
src/jalview/gui/FeatureRenderer.java

index e608552..5f257c7 100644 (file)
@@ -366,6 +366,9 @@ public class FeatureRenderer extends
             : MessageManager.formatMessage("label.amend_delete_features",
                     new String[] { sequences.get(0).getName() });
 
+    /*
+     * show the dialog
+     */
     int reply = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
             mainPanel, title, JvOptionPane.YES_NO_CANCEL_OPTION,
             JvOptionPane.QUESTION_MESSAGE, null, options,
@@ -391,10 +394,17 @@ public class FeatureRenderer extends
 
       if (reply == JvOptionPane.NO_OPTION)
       {
+        /*
+         * NO_OPTION corresponds to the Delete button
+         */
         sequences.get(0).getDatasetSequence().deleteFeature(sf);
       }
       else if (reply == JvOptionPane.YES_OPTION)
       {
+        /*
+         * YES_OPTION corresponds to the Amend button
+         */
+        boolean typeChanged = !lastFeatureAdded.equals(sf.type);
         sf.type = lastFeatureAdded;
         sf.featureGroup = lastFeatureGroupAdded;
         sf.description = lastDescriptionAdded;
@@ -411,6 +421,10 @@ public class FeatureRenderer extends
         }
 
         ffile.parseDescriptionHTML(sf, false);
+        if (typeChanged)
+        {
+          findAllFeatures();
+        }
       }
     }
     else