From eca2aab88d75e0f99b1d1cdd0d1a7c2d50445dd1 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 20 Jun 2006 11:28:37 +0000
Subject: [PATCH] report unknown keys

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4438 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 .../artemis/io/SimpleDocumentEntry.java       | 25 +++++++++++++++----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java b/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
index 5d29fcdb1..1b20bd60e 100644
--- a/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
+++ b/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java,v 1.18 2005-11-28 16:46:38 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/io/SimpleDocumentEntry.java,v 1.19 2006-06-20 11:28:37 tjc Exp $
  */
 
 package uk.ac.sanger.artemis.io;
@@ -32,12 +32,13 @@ import java.util.Date;
 import java.util.Vector;
 import java.util.Hashtable;
 import java.util.Enumeration;
+import javax.swing.JOptionPane;
 
 /**
  *  This class contains the methods common to all DocumentEntry objects.
  *
  *  @author Kim Rutherford <kmr@sanger.ac.uk>
- *  @version $Id: SimpleDocumentEntry.java,v 1.18 2005-11-28 16:46:38 tjc Exp $
+ *  @version $Id: SimpleDocumentEntry.java,v 1.19 2006-06-20 11:28:37 tjc Exp $
  **/
 
 abstract public class SimpleDocumentEntry
@@ -327,16 +328,23 @@ abstract public class SimpleDocumentEntry
 
     final FeatureEnumeration feature_enum = new_entry.features();
 
+    final StringBuffer failed = new StringBuffer();
     while(feature_enum.hasMoreFeatures()) 
     {
       final Feature new_feature = feature_enum.nextFeature();
-
+      
       try
       {
         if(force) 
-          forcedAdd(makeNativeFeature(new_feature, true));
-        else 
+        {
+          if(forcedAdd(makeNativeFeature(new_feature, true)) == null)
+            failed.append(new_feature.getKey().getKeyString()+"\n"); 
+        }
+        else
+        {
+          
           add(makeNativeFeature(new_feature, true));
+        }
       } 
       catch(ReadOnlyException e) 
       {
@@ -344,6 +352,13 @@ abstract public class SimpleDocumentEntry
       }
     }
 
+    if(!failed.toString().equals(""))
+      JOptionPane.showMessageDialog(null, 
+          "Failed to use the following keys\n"+
+          failed.toString(),
+          "Warning - unknown keys",
+          JOptionPane.WARNING_MESSAGE);
+    
     final Sequence new_sequence = new_entry.getSequence();
 
     if(new_sequence != null) 
-- 
GitLab