JAL-2046 add/delete SequenceFeature operate on dataset if one is defined
authorJim Procter <jprocter@issues.jalview.org>
Tue, 5 Apr 2016 17:32:07 +0000 (18:32 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 5 Apr 2016 17:45:36 +0000 (18:45 +0100)
src/jalview/datamodel/Sequence.java

index 5bfdb04..a61f093 100755 (executable)
@@ -312,7 +312,11 @@ public class Sequence extends ASequence implements SequenceI
   @Override
   public synchronized void addSequenceFeature(SequenceFeature sf)
   {
-    // TODO add to dataset sequence instead if there is one?
+    if (sequenceFeatures==null && datasetSequence != null)
+    {
+      datasetSequence.addSequenceFeature(sf);
+      return;
+    }
     if (sequenceFeatures == null)
     {
       sequenceFeatures = new SequenceFeature[0];
@@ -338,6 +342,9 @@ public class Sequence extends ASequence implements SequenceI
   {
     if (sequenceFeatures == null)
     {
+      if (datasetSequence!=null) {
+         datasetSequence.deleteFeature(sf);
+      }
       return;
     }