X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2Ftools%2FTaxonomyDataObtainer.java;h=a6d814b1500c8114024061ea1a2b488d65270ffd;hb=d772adf9d23c4cdbf84b2af9d23e2e7ebedfcf3a;hp=952d3fa11265bfb4a2735c5c0c51c27c9d4d8dbc;hpb=93b3ffddb203151c92200b3498d5559cc4de7d18;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java b/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java index 952d3fa..a6d814b 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/TaxonomyDataObtainer.java @@ -33,12 +33,13 @@ import java.util.SortedSet; import javax.swing.JOptionPane; import org.forester.analysis.AncestralTaxonomyInference; +import org.forester.analysis.AncestralTaxonomyInferenceException; import org.forester.archaeopteryx.MainFrameApplication; import org.forester.archaeopteryx.TreePanel; import org.forester.phylogeny.Phylogeny; import org.forester.ws.uniprot.UniProtWsTools; -public class TaxonomyDataObtainer implements Runnable { +public class TaxonomyDataObtainer extends RunnableProcess { private final Phylogeny _phy; private final MainFrameApplication _mf; @@ -48,7 +49,7 @@ public class TaxonomyDataObtainer implements Runnable { public TaxonomyDataObtainer( final MainFrameApplication mf, final TreePanel treepanel, final Phylogeny phy, - boolean delete ) { + final boolean delete ) { _phy = phy; _mf = mf; _treepanel = treepanel; @@ -67,13 +68,12 @@ public class TaxonomyDataObtainer implements Runnable { } private void execute() { - _mf.getMainPanel().getCurrentTreePanel().setWaitCursor(); + start( _mf, "taxonomy data" ); SortedSet not_found = null; try { not_found = AncestralTaxonomyInference.obtainDetailedTaxonomicInformation( _phy, _delete ); } catch ( final UnknownHostException e ) { - _mf.getMainPanel().getCurrentTreePanel().setArrowCursor(); JOptionPane.showMessageDialog( _mf, "Could not connect to \"" + getBaseUrl() + "\"", "Network error during taxonomic information gathering", @@ -81,7 +81,14 @@ public class TaxonomyDataObtainer implements Runnable { return; } catch ( final IOException e ) { - _mf.getMainPanel().getCurrentTreePanel().setArrowCursor(); + e.printStackTrace(); + JOptionPane.showMessageDialog( _mf, + e.toString(), + "Failed to obtain taxonomic information", + JOptionPane.ERROR_MESSAGE ); + return; + } + catch ( final AncestralTaxonomyInferenceException e ) { e.printStackTrace(); JOptionPane.showMessageDialog( _mf, e.toString(), @@ -90,7 +97,19 @@ public class TaxonomyDataObtainer implements Runnable { return; } finally { - _mf.getMainPanel().getCurrentTreePanel().setArrowCursor(); + end( _mf ); + } + if ( _phy == null || _phy.isEmpty() ) { + try { + JOptionPane.showMessageDialog( _mf, + "None of the external node taxonomies could be resolved", + "Taxonomy Tool Failed", + JOptionPane.WARNING_MESSAGE ); + } + catch ( final Exception e ) { + // Not important if this fails, do nothing. + } + return; } _treepanel.setTree( _phy ); _mf.showWhole();