From fee427f136e57790d514cec293de7a0fff173afd Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 2 Nov 2005 16:56:37 +0000 Subject: [PATCH] Java 1.5 bug note --- src/jalview/io/SequenceFeatureFetcher.java | 38 ++++++++++++++++++---------- src/jalview/io/WSWUBlastClient.java | 2 ++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/jalview/io/SequenceFeatureFetcher.java b/src/jalview/io/SequenceFeatureFetcher.java index 108fe08..2bfbfd9 100755 --- a/src/jalview/io/SequenceFeatureFetcher.java +++ b/src/jalview/io/SequenceFeatureFetcher.java @@ -57,7 +57,7 @@ public class SequenceFeatureFetcher implements Runnable { // 1. Load the mapping information from the file Mapping map = new Mapping(uni.getClass().getClassLoader()); - java.net.URL url = uni.getClass().getResource("/uniprot_mapping.xml"); + java.net.URL url = getClass().getResource("/uniprot_mapping.xml"); map.loadMapping(url); // 2. Unmarshal the data @@ -156,19 +156,29 @@ public class SequenceFeatureFetcher implements Runnable } - if (unknownSequences.size() > 0) - { - int reply = javax.swing.JOptionPane.showInternalConfirmDialog( - Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences." - +"\nPerform blast for unknown sequences?", - "Blast for Unidentified Sequences", - javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); - - if(reply == javax.swing.JOptionPane.YES_OPTION) - new WSWUBlastClient(ap, align, unknownSequences); - } - else - ((Alignment)dataset).featuresAdded = true; + promptBeforeBlast(); + + } + + + void promptBeforeBlast() + { + // This must be outside the run() body as java 1.5 + // will not return any value from the OptionPane to the expired thread. + if (unknownSequences.size() > 0) + { + int reply = javax.swing.JOptionPane.showConfirmDialog( + Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences." + +"\nPerform blast for unknown sequences?", + "Blast for Unidentified Sequences", + javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); + + System.out.println("response ?? "+reply); + if(reply == javax.swing.JOptionPane.YES_OPTION) + new WSWUBlastClient(ap, align, unknownSequences); + } + else + ((Alignment)dataset).featuresAdded = true; ap.repaint(); diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java index 36e5dfd..41729ce 100755 --- a/src/jalview/io/WSWUBlastClient.java +++ b/src/jalview/io/WSWUBlastClient.java @@ -141,6 +141,8 @@ public class WSWUBlastClient void updateIds() { + // This must be outside the run() body as java 1.5 + // will not return any value from the OptionPane to the expired thread. int reply = JOptionPane.showConfirmDialog( Desktop.desktop, "Automatically update suggested ids?", "Auto replace sequence ids", JOptionPane.YES_NO_OPTION); -- 1.7.10.2