JAL-2506 allow graduated colour as default in new Sequence Feature
[jalview.git] / src / jalview / gui / FeatureRenderer.java
index e608552..50a8689 100644 (file)
@@ -165,7 +165,8 @@ public class FeatureRenderer extends
         {
           if (fcc == null)
           {
-            final String type = features.get(featureIndex).getType();
+            final String ft = features.get(featureIndex).getType();
+            final String type = ft == null ? lastFeatureAdded : ft;
             fcc = new FeatureColourChooser(me, type);
             fcc.setRequestFocusEnabled(true);
             fcc.requestFocus();
@@ -366,6 +367,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 +395,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 +422,10 @@ public class FeatureRenderer extends
         }
 
         ffile.parseDescriptionHTML(sf, false);
+        if (typeChanged)
+        {
+          findAllFeatures();
+        }
       }
     }
     else