- if (featureType != null)
- {
- lastFeatureAdded = featureType;
- }
- else
- {
- if (lastFeatureAdded == null)
- {
- if (features[0].type != null)
- {
- lastFeatureAdded = features[0].type;
- }
- else
- {
- lastFeatureAdded = "feature_1";
- }
- }
- }
-
- if (lastFeatureGroupAdded == null)
- {
- if (features[0].featureGroup != null)
- {
- lastFeatureGroupAdded = features[0].featureGroup;
- }
- else
- {
- lastFeatureAdded = "Jalview";
- }
- }
+ /*
+ * use defaults for type and group (and update them on Confirm) only
+ * if feature type has not been supplied by the caller
+ * (e.g. for Amend, or create features from Find)
+ */
+ boolean useLastDefaults = features[0].getType() == null;
+ String featureType = useLastDefaults ? lastFeatureAdded : features[0]
+ .getType();
+ String featureGroup = useLastDefaults ? lastFeatureGroupAdded
+ : features[0].getFeatureGroup();