update modification state flag according to parsing activity
authorjprocter <Jim Procter>
Wed, 15 Dec 2010 14:51:08 +0000 (14:51 +0000)
committerjprocter <Jim Procter>
Wed, 15 Dec 2010 14:51:08 +0000 (14:51 +0000)
src/jalview/io/packed/ParsePackedSet.java

index 20b2061..787a88f 100644 (file)
@@ -76,6 +76,7 @@ public class ParsePackedSet
               // deuniquify and construct/merge additional dataset entries if
               // necessary.
               context.addAlignment(al);
+              context.updateSetModified(true);
               rslt.add(al);
               deuniquify = true;
             }
@@ -101,8 +102,8 @@ public class ParsePackedSet
           {
             br = new BufferedReader(src.getReader());
           }
-          new jalview.io.AnnotationFile().parseAnnotationFrom(
-                  context.getLastAlignment(), br);
+          context.updateSetModified(new jalview.io.AnnotationFile()
+                  .parseAnnotationFrom(context.getLastAlignment(), br));
 
         } catch (Exception e)
         {
@@ -123,16 +124,17 @@ public class ParsePackedSet
       }
       if (dta.getType().equals(JvDataType.FEATURES))
       {
-        // check the context has a place to store feature rendering definitions, if not, create one.
-        if (context.featureColours==null)
+        // check the context has a place to store feature rendering definitions,
+        // if not, create one.
+        if (context.featureColours == null)
         {
           context.featureColours = new Hashtable();
         }
         try
         {
           jalview.io.FeaturesFile ff = new jalview.io.FeaturesFile(src);
-          ff.parse(context.getLastAlignment(), context.featureColours,
-                  false);
+          context.updateSetModified(ff.parse(context.getLastAlignment(),
+                  context.featureColours, false));
         } catch (Exception e)
         {
           errmsg = ("Failed to parse the Features file associated with the alignment.");
@@ -155,6 +157,7 @@ public class ParsePackedSet
 
             context.addTreeFromFile(nf);
             rslt.add(nf);
+            context.updateSetModified(true);
           }
         } catch (Exception e)
         {
@@ -248,6 +251,11 @@ public class ParsePackedSet
       // to buffers.
       // import with deuniquify info, and compare results to input.
 
+    } else {
+      if (context.getLastAlignmentSet().isModified())
+      {
+        System.err.println("Initial alignment set was modified and any associated views should be updated.");
+      }
     }
   }
 }