JAL-2326 updated references of JOptionPane to JvOptionPane
[jalview.git] / src / jalview / gui / StructureChooser.java
index 3350f6c..0c3aa2a 100644 (file)
@@ -83,6 +83,8 @@ public class StructureChooser extends GStructureChooser implements
 
   private boolean cachedPDBExists;
 
+  private static int MAX_QLENGHT = 7820;
+
   public StructureChooser(SequenceI[] selectedSeqs, SequenceI selectedSeq,
           AlignmentPanel ap)
   {
@@ -214,9 +216,9 @@ public class StructureChooser extends GStructureChooser implements
         {
           errorMsg.append(error).append("\n");
         }
-        JOptionPane.showMessageDialog(this, errorMsg.toString(),
+        JvOptionPane.showMessageDialog(this, errorMsg.toString(),
                 MessageManager.getString("label.pdb_web-service_error"),
-                JOptionPane.ERROR_MESSAGE);
+                JvOptionPane.ERROR_MESSAGE);
       }
     }
   }
@@ -259,7 +261,8 @@ public class StructureChooser extends GStructureChooser implements
     StringBuilder queryBuilder = new StringBuilder();
     Set<String> seqRefs = new LinkedHashSet<String>();
 
-    if (seq.getAllPDBEntries() != null)
+    if (seq.getAllPDBEntries() != null
+            && queryBuilder.length() < MAX_QLENGHT)
     {
       for (PDBEntry entry : seq.getAllPDBEntries())
       {
@@ -268,7 +271,6 @@ public class StructureChooser extends GStructureChooser implements
           queryBuilder.append("pdb_id:")
                   .append(entry.getId().toLowerCase()).append(" OR ");
           isPDBRefsFound = true;
-          // seqRefs.add(entry.getId());
         }
       }
     }
@@ -277,7 +279,8 @@ public class StructureChooser extends GStructureChooser implements
     {
       for (DBRefEntry dbRef : seq.getDBRefs())
       {
-        if (isValidSeqName(getDBRefId(dbRef)))
+        if (isValidSeqName(getDBRefId(dbRef))
+                && queryBuilder.length() < MAX_QLENGHT)
         {
           if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
           {
@@ -481,11 +484,11 @@ public class StructureChooser extends GStructureChooser implements
             {
               errorMsg.append(error).append("\n");
             }
-            JOptionPane.showMessageDialog(
+            JvOptionPane.showMessageDialog(
                     null,
                     errorMsg.toString(),
                     MessageManager.getString("label.pdb_web-service_error"),
-                    JOptionPane.ERROR_MESSAGE);
+                    JvOptionPane.ERROR_MESSAGE);
           }
         }